• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc  -march=hexagon -relocation-model=pic < %s | FileCheck %s
2
3; Force the use of R14 (by clobbering everything else in the inline asm).
4; Make sure that R14 is not set before the __save call (which will clobber
5; R14, R15 and R28).
6; CHECK: call __save_r16_through_r27
7; CHECK: }
8; CHECK: r14{{ *}}=
9
10@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
11
12; Function Attrs: nounwind optsize
13define i32 @_Z7testR14Pi(i32* nocapture %res) #0 {
14entry:
15  %0 = load i32, i32* %res, align 4
16  %1 = tail call { i32, i32 } asm "r0=$2\0A\09$1=add(r0,#$3)\0A\09$0=add(r0,#$4)\0A\09", "=r,=r,r,i,i,~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27}"(i32 %0, i32 40, i32 50) #1
17  %asmresult = extractvalue { i32, i32 } %1, 0
18  %asmresult1 = extractvalue { i32, i32 } %1, 1
19  store i32 %asmresult, i32* %res, align 4
20  %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %asmresult1) #2
21  %2 = load i32, i32* %res, align 4
22  %call2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %2) #2
23  ret i32 0
24}
25
26; Function Attrs: nounwind optsize
27declare i32 @printf(i8*, ...) #0
28
29; Same as above for R15.
30; CHECK: call __save_r16_through_r27
31; CHECK: }
32; CHECK: r15{{ *}}=
33
34; Function Attrs: nounwind optsize
35define i32 @_Z7testR15Pi(i32* nocapture %res) #0 {
36entry:
37  %0 = load i32, i32* %res, align 4
38  %1 = tail call { i32, i32 } asm "r0=$2\0A\09$1=add(r0,#$3)\0A\09$0=add(r0,#$4)\0A\09", "=r,=r,r,i,i,~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27}"(i32 %0, i32 40, i32 50) #1
39  %asmresult = extractvalue { i32, i32 } %1, 0
40  %asmresult1 = extractvalue { i32, i32 } %1, 1
41  store i32 %asmresult, i32* %res, align 4
42  %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %asmresult1) #2
43  %2 = load i32, i32* %res, align 4
44  %call2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %2) #2
45  ret i32 0
46}
47
48; Same as above for R28.
49; CHECK: call __save_r16_through_r27
50; CHECK: }
51; CHECK: r28{{ *}}=
52
53; Function Attrs: nounwind optsize
54define i32 @_Z7testR28Pi(i32* nocapture %res) #0 {
55entry:
56  %0 = load i32, i32* %res, align 4
57  %1 = tail call { i32, i32 } asm "r0=$2\0A\09$1=add(r0,#$3)\0A\09$0=add(r0,#$4)\0A\09", "=r,=r,r,i,i,~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26}"(i32 %0, i32 40, i32 50) #1
58  %asmresult = extractvalue { i32, i32 } %1, 0
59  %asmresult1 = extractvalue { i32, i32 } %1, 1
60  store i32 %asmresult, i32* %res, align 4
61  %call = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %asmresult1) #2
62  %2 = load i32, i32* %res, align 4
63  %call2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 %2) #2
64  ret i32 0
65}
66
67attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
68attributes #1 = { nounwind }
69attributes #2 = { nounwind optsize }
70