18
18
define double @f1 (double %f , i32 %pscr_value ) {
19
19
entry:
20
20
%f.addr = alloca double , align 8
21
- store double %f , double * %f.addr , align 8
22
- call void asm sideeffect "msr fpsr,$1" , "=*X,r" (double * elementtype(double ) nonnull %f.addr , i32 %pscr_value ) nounwind
23
- %0 = load double , double * %f.addr , align 8
21
+ store double %f , ptr %f.addr , align 8
22
+ call void asm sideeffect "msr fpsr,$1" , "=*X,r" (ptr elementtype(double ) nonnull %f.addr , i32 %pscr_value ) nounwind
23
+ %0 = load double , ptr %f.addr , align 8
24
24
%add = fadd double %0 , %0
25
25
ret double %add
26
26
}
36
36
define i32 @f2 (i32 %f , i32 %pscr_value ) {
37
37
entry:
38
38
%f.addr = alloca i32 , align 4
39
- store i32 %f , i32* %f.addr , align 4
40
- call void asm sideeffect "msr fpsr,$1" , "=*X,r" (i32* elementtype(i32 ) nonnull %f.addr , i32 %pscr_value ) nounwind
41
- %0 = load i32 , i32* %f.addr , align 4
39
+ store i32 %f , ptr %f.addr , align 4
40
+ call void asm sideeffect "msr fpsr,$1" , "=*X,r" (ptr elementtype(i32 ) nonnull %f.addr , i32 %pscr_value ) nounwind
41
+ %0 = load i32 , ptr %f.addr , align 4
42
42
%mul = mul i32 %0 , %0
43
43
ret i32 %mul
44
44
}
@@ -59,10 +59,9 @@ entry:
59
59
define <8 x i8 > @f3 () {
60
60
entry:
61
61
%vector_res_int8x8 = alloca <8 x i8 >, align 8
62
- %0 = getelementptr inbounds <8 x i8 >, <8 x i8 >* %vector_res_int8x8 , i32 0 , i32 0
63
- call void asm sideeffect "msr fpsr,$1" , "=*X,r" (<8 x i8 >* elementtype(<8 x i8 >) nonnull %vector_res_int8x8 , i32 undef ) nounwind
64
- %1 = load <8 x i8 >, <8 x i8 >* %vector_res_int8x8 , align 8
65
- %mul = mul <8 x i8 > %1 , %1
62
+ call void asm sideeffect "msr fpsr,$1" , "=*X,r" (ptr elementtype(<8 x i8 >) nonnull %vector_res_int8x8 , i32 undef ) nounwind
63
+ %0 = load <8 x i8 >, ptr %vector_res_int8x8 , align 8
64
+ %mul = mul <8 x i8 > %0 , %0
66
65
ret <8 x i8 > %mul
67
66
}
68
67
@@ -90,31 +89,24 @@ entry:
90
89
; CHECK: bl f4
91
90
define void @f5 () {
92
91
entry:
93
- tail call void asm sideeffect "bl $0" , "X" (void ()* nonnull @f4 )
92
+ tail call void asm sideeffect "bl $0" , "X" (ptr nonnull @f4 )
94
93
ret void
95
94
}
96
95
97
96
declare void @foo (...)
98
97
99
98
; This tests the behavior of the X constraint when used on functions pointers,
100
- ; or functions with a cast. In the first asm call we figure out that this
101
- ; is a function pointer and emit the label. However, in the second asm call
102
- ; we can't see through the bitcast and we end up having to lower this constraint
103
- ; to something else. This is not ideal, but it is a correct behaviour according
104
- ; to the definition of the X constraint.
105
- ;
106
- ; In this case (and other cases where we could have emitted something else),
107
- ; what we're doing with the X constraint is not particularly useful either,
108
- ; since the user could have used "r" in this situation for the same effect.
99
+ ; or functions with a cast. We figure out that this is a function pointer and
100
+ ; emit the label.
109
101
110
102
; CHECK-LABEL: f6
111
103
; CHECK: bl foo
112
- ; CHECK: br x
104
+ ; CHECK: bl f4
113
105
114
106
define void @f6 () nounwind {
115
107
entry:
116
- tail call void asm sideeffect "bl $0" , "X" (void (...)* @foo ) nounwind
117
- tail call void asm sideeffect "br $0" , "X" (void (...)* bitcast ( void ()* @f4 to void (...)*) ) nounwind
108
+ tail call void asm sideeffect "bl $0" , "X" (ptr @foo ) nounwind
109
+ tail call void asm sideeffect "bl $0" , "X" (ptr @f4 ) nounwind
118
110
ret void
119
111
}
120
112
@@ -129,7 +121,7 @@ entry:
129
121
; CHECK-LABEL: f7
130
122
; CHECK: bl .Ltmp3
131
123
define void @f7 () {
132
- call void asm sideeffect "bl $0" , "X" ( i8* blockaddress (@f7 , %bb ) )
124
+ call void asm sideeffect "bl $0" , "X" ( ptr blockaddress (@f7 , %bb ) )
133
125
br label %bb
134
126
bb:
135
127
ret void
139
131
; CHECK-LABEL: f8
140
132
; CHECK: add [[Dest:x[0-9]+]], x0, x0
141
133
; CHECK: str [[Dest]], [x0]
142
- define void @f8 (i64 * %x ) {
134
+ define void @f8 (ptr %x ) {
143
135
entry:
144
- tail call void asm sideeffect "add $0, x0, x0" , "=*X" (i64* elementtype(i64 ) %x )
136
+ tail call void asm sideeffect "add $0, x0, x0" , "=*X" (ptr elementtype(i64 ) %x )
145
137
ret void
146
138
}
0 commit comments