1*f4a2713aSLionel Sambuc // RUN: %clang -target mipsel-unknown-linux -S -o - -emit-llvm %s \ 2*f4a2713aSLionel Sambuc // RUN: | FileCheck %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc // This checks that the frontend will accept inline asm operand modifiers 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc int printf(const char*, ...); 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc typedef int v4i32 __attribute__((vector_size(16))); 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc // 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, 11*f4a2713aSLionel Sambuc // 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, 12*f4a2713aSLionel Sambuc // CHECK: %{{[0-9]+}} = call <4 x i32> asm "ldi.w ${0:w},1", "=f" 13*f4a2713aSLionel Sambuc int b[8] = {0,1,2,3,4,5,6,7}; 14*f4a2713aSLionel Sambuc int main() 15*f4a2713aSLionel Sambuc { 16*f4a2713aSLionel Sambuc int i; 17*f4a2713aSLionel Sambuc v4i32 v4i32_r; 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc // The first word. Notice, no 'D' 20*f4a2713aSLionel Sambuc {asm ( 21*f4a2713aSLionel Sambuc ".set noreorder;\n" 22*f4a2713aSLionel Sambuc "lw %0,%1;\n" 23*f4a2713aSLionel Sambuc ".set reorder;\n" 24*f4a2713aSLionel Sambuc : "=r" (i) 25*f4a2713aSLionel Sambuc : "m" (*(b+4)));} 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc printf("%d\n",i); 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc // The second word 30*f4a2713aSLionel Sambuc {asm ( 31*f4a2713aSLionel Sambuc "lw %0,%D1;\n" 32*f4a2713aSLionel Sambuc : "=r" (i) 33*f4a2713aSLionel Sambuc : "m" (*(b+4)) 34*f4a2713aSLionel Sambuc );} 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc // MSA registers 37*f4a2713aSLionel Sambuc {asm ("ldi.w %w0,1" : "=f" (v4i32_r));} 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc printf("%d\n",i); 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc return 1; 42*f4a2713aSLionel Sambuc } 43