Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang -target mipsel-unknown-linux -S -o - -emit-llvm %s \
      2 // RUN: | FileCheck %s
      3 
      4 // This checks that the frontend will accept inline asm operand modifiers
      5 
      6 int printf(const char*, ...);
      7 
      8   // CHECK: %{{[0-9]+}} = call i32 asm ".set noreorder;\0Alw    $0,$1;\0A.set reorder;\0A", "=r,*m"(i32* getelementptr inbounds ([8 x i32]* @b, i32 {{[0-9]+}}, i32 {{[0-9]+}})) #2,
      9   // CHECK: %{{[0-9]+}} = call i32 asm "lw    $0,${1:D};\0A", "=r,*m"(i32* getelementptr inbounds ([8 x i32]* @b, i32 {{[0-9]+}}, i32 {{[0-9]+}})) #2,
     10 int b[8] = {0,1,2,3,4,5,6,7};
     11 int  main()
     12 {
     13   int i;
     14 
     15   // The first word. Notice, no 'D'
     16   {asm (
     17   ".set noreorder;\n"
     18   "lw    %0,%1;\n"
     19   ".set reorder;\n"
     20   : "=r" (i)
     21   : "m" (*(b+4)));}
     22 
     23   printf("%d\n",i);
     24 
     25   // The second word
     26   {asm (
     27   "lw    %0,%D1;\n"
     28   : "=r" (i)
     29   : "m" (*(b+4))
     30   );}
     31 
     32   printf("%d\n",i);
     33 
     34   return 1;
     35 }
     36