1 ; RUN: llc -mtriple=hexagon -relocation-model=pic < %s | FileCheck %s
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
6 ; CHECK: call __save_r16_through_r27
10 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
12 ; Function Attrs: nounwind optsize
13 define i32 @_Z7testR14Pi(ptr nocapture %res) #0 {
15 %0 = load i32, ptr %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, ptr %res, align 4
20 %call = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %asmresult1) #2
21 %2 = load i32, ptr %res, align 4
22 %call2 = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %2) #2
26 ; Function Attrs: nounwind optsize
27 declare i32 @printf(ptr, ...) #0
29 ; Same as above for R15.
30 ; CHECK: call __save_r16_through_r27
34 ; Function Attrs: nounwind optsize
35 define i32 @_Z7testR15Pi(ptr nocapture %res) #0 {
37 %0 = load i32, ptr %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, ptr %res, align 4
42 %call = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %asmresult1) #2
43 %2 = load i32, ptr %res, align 4
44 %call2 = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %2) #2
48 ; Same as above for R28.
49 ; CHECK: call __save_r16_through_r27
53 ; Function Attrs: nounwind optsize
54 define i32 @_Z7testR28Pi(ptr nocapture %res) #0 {
56 %0 = load i32, ptr %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, ptr %res, align 4
61 %call = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %asmresult1) #2
62 %2 = load i32, ptr %res, align 4
63 %call2 = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %2) #2
67 attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
68 attributes #1 = { nounwind }
69 attributes #2 = { nounwind optsize }