首页 > 代码库 > 汇编三个数选最大
汇编三个数选最大
1 #include <stdio.h> 2 3 int main() 4 { 5 int i = 9; 6 int j = 67; 7 int k = 34; 8 int max = 0; 9 #if 0 10 11 if(i >= j) 12 max = i; 13 else 14 max = j; 15 if(k > max) 16 max = k; 17 exit: 18 #else 19 __asm__ __volatile__( 20 "mov r0, %1\n" 21 "mov r1, %2\n" 22 "mov r2, %3\n" 23 "cmp r0, r1\n" 24 "movge %0, r0\n" 25 "movle %0, r1\n" 26 "cmp %0, r2\n" 27 "movle %0, r2\n" 28 :"=r" (max) 29 :"r" (i), "r" (j), "r" (k) 30 :"r0", "r1", "r2", "memory" 31 ); 32 #endif 33 34 printf("%d\n", max); 35 }
汇编三个数选最大
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。