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