Maximum number of three parts in assembly

Source: Internet
Author: User
  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 }

 

Maximum number of three parts in assembly

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.