Skip to content

Commit eeedb1e

Browse files
committed
[FPEnv][X86] Correct one more strictfp test.
Correct a strictfp test to follow the rules documented in the LangRef: https://llvm.org/docs/LangRef.html#constrained-floating-point-intrinsics This test needed the strictfp attribute added to some function definitions. FP wait instructions now appear as a result. The need for the wait instructions is explained by Andy Kaylor in PR#87791: #87791 Test changes verified with D146845.
1 parent fd2ffc1 commit eeedb1e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

llvm/test/CodeGen/X86/i128-fpconv-win64-strict.ll

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; RUN: llc < %s -mtriple=x86_64-win32 | FileCheck %s -check-prefix=WIN64
33
; RUN: llc < %s -mtriple=x86_64-mingw32 | FileCheck %s -check-prefix=WIN64
44

5-
define i64 @double_to_i128(double %d) nounwind {
5+
define i64 @double_to_i128(double %d) nounwind strictfp {
66
; WIN64-LABEL: double_to_i128:
77
; WIN64: # %bb.0:
88
; WIN64-NEXT: subq $40, %rsp
@@ -15,7 +15,7 @@ define i64 @double_to_i128(double %d) nounwind {
1515
ret i64 %2
1616
}
1717

18-
define i64 @double_to_ui128(double %d) nounwind {
18+
define i64 @double_to_ui128(double %d) nounwind strictfp {
1919
; WIN64-LABEL: double_to_ui128:
2020
; WIN64: # %bb.0:
2121
; WIN64-NEXT: subq $40, %rsp
@@ -28,7 +28,7 @@ define i64 @double_to_ui128(double %d) nounwind {
2828
ret i64 %2
2929
}
3030

31-
define i64 @float_to_i128(float %d) nounwind {
31+
define i64 @float_to_i128(float %d) nounwind strictfp {
3232
; WIN64-LABEL: float_to_i128:
3333
; WIN64: # %bb.0:
3434
; WIN64-NEXT: subq $40, %rsp
@@ -41,7 +41,7 @@ define i64 @float_to_i128(float %d) nounwind {
4141
ret i64 %2
4242
}
4343

44-
define i64 @float_to_ui128(float %d) nounwind {
44+
define i64 @float_to_ui128(float %d) nounwind strictfp {
4545
; WIN64-LABEL: float_to_ui128:
4646
; WIN64: # %bb.0:
4747
; WIN64-NEXT: subq $40, %rsp
@@ -54,12 +54,13 @@ define i64 @float_to_ui128(float %d) nounwind {
5454
ret i64 %2
5555
}
5656

57-
define i64 @longdouble_to_i128(ptr nocapture readonly %0) nounwind {
57+
define i64 @longdouble_to_i128(ptr nocapture readonly %0) nounwind strictfp {
5858
; WIN64-LABEL: longdouble_to_i128:
5959
; WIN64: # %bb.0:
6060
; WIN64-NEXT: subq $56, %rsp
6161
; WIN64-NEXT: fldt (%rcx)
6262
; WIN64-NEXT: fstpt {{[0-9]+}}(%rsp)
63+
; WIN64-NEXT: wait
6364
; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
6465
; WIN64-NEXT: callq __fixxfti
6566
; WIN64-NEXT: movq %xmm0, %rax
@@ -71,12 +72,13 @@ define i64 @longdouble_to_i128(ptr nocapture readonly %0) nounwind {
7172
ret i64 %4
7273
}
7374

74-
define i64 @longdouble_to_ui128(ptr nocapture readonly %0) nounwind {
75+
define i64 @longdouble_to_ui128(ptr nocapture readonly %0) nounwind strictfp {
7576
; WIN64-LABEL: longdouble_to_ui128:
7677
; WIN64: # %bb.0:
7778
; WIN64-NEXT: subq $56, %rsp
7879
; WIN64-NEXT: fldt (%rcx)
7980
; WIN64-NEXT: fstpt {{[0-9]+}}(%rsp)
81+
; WIN64-NEXT: wait
8082
; WIN64-NEXT: leaq {{[0-9]+}}(%rsp), %rcx
8183
; WIN64-NEXT: callq __fixunsxfti
8284
; WIN64-NEXT: movq %xmm0, %rax
@@ -88,7 +90,7 @@ define i64 @longdouble_to_ui128(ptr nocapture readonly %0) nounwind {
8890
ret i64 %4
8991
}
9092

91-
define double @i128_to_double(ptr nocapture readonly %0) nounwind {
93+
define double @i128_to_double(ptr nocapture readonly %0) nounwind strictfp {
9294
; WIN64-LABEL: i128_to_double:
9395
; WIN64: # %bb.0:
9496
; WIN64-NEXT: subq $56, %rsp
@@ -103,7 +105,7 @@ define double @i128_to_double(ptr nocapture readonly %0) nounwind {
103105
ret double %3
104106
}
105107

106-
define double @ui128_to_double(ptr nocapture readonly %0) nounwind {
108+
define double @ui128_to_double(ptr nocapture readonly %0) nounwind strictfp {
107109
; WIN64-LABEL: ui128_to_double:
108110
; WIN64: # %bb.0:
109111
; WIN64-NEXT: subq $56, %rsp
@@ -118,7 +120,7 @@ define double @ui128_to_double(ptr nocapture readonly %0) nounwind {
118120
ret double %3
119121
}
120122

121-
define float @i128_to_float(ptr nocapture readonly %0) nounwind {
123+
define float @i128_to_float(ptr nocapture readonly %0) nounwind strictfp {
122124
; WIN64-LABEL: i128_to_float:
123125
; WIN64: # %bb.0:
124126
; WIN64-NEXT: subq $56, %rsp
@@ -133,7 +135,7 @@ define float @i128_to_float(ptr nocapture readonly %0) nounwind {
133135
ret float %3
134136
}
135137

136-
define float @ui128_to_float(ptr nocapture readonly %0) nounwind {
138+
define float @ui128_to_float(ptr nocapture readonly %0) nounwind strictfp {
137139
; WIN64-LABEL: ui128_to_float:
138140
; WIN64: # %bb.0:
139141
; WIN64-NEXT: subq $56, %rsp
@@ -148,7 +150,7 @@ define float @ui128_to_float(ptr nocapture readonly %0) nounwind {
148150
ret float %3
149151
}
150152

151-
define void @i128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %agg.result, ptr nocapture readonly %0) nounwind {
153+
define void @i128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %agg.result, ptr nocapture readonly %0) nounwind strictfp {
152154
; WIN64-LABEL: i128_to_longdouble:
153155
; WIN64: # %bb.0:
154156
; WIN64-NEXT: pushq %rsi
@@ -161,6 +163,7 @@ define void @i128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %a
161163
; WIN64-NEXT: callq __floattixf
162164
; WIN64-NEXT: fldt {{[0-9]+}}(%rsp)
163165
; WIN64-NEXT: fstpt (%rsi)
166+
; WIN64-NEXT: wait
164167
; WIN64-NEXT: movq %rsi, %rax
165168
; WIN64-NEXT: addq $64, %rsp
166169
; WIN64-NEXT: popq %rsi
@@ -171,7 +174,7 @@ define void @i128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %a
171174
ret void
172175
}
173176

174-
define void @ui128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %agg.result, ptr nocapture readonly %0) nounwind {
177+
define void @ui128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %agg.result, ptr nocapture readonly %0) nounwind strictfp {
175178
; WIN64-LABEL: ui128_to_longdouble:
176179
; WIN64: # %bb.0:
177180
; WIN64-NEXT: pushq %rsi
@@ -184,6 +187,7 @@ define void @ui128_to_longdouble(ptr noalias nocapture sret(x86_fp80) align 16 %
184187
; WIN64-NEXT: callq __floatuntixf
185188
; WIN64-NEXT: fldt {{[0-9]+}}(%rsp)
186189
; WIN64-NEXT: fstpt (%rsi)
190+
; WIN64-NEXT: wait
187191
; WIN64-NEXT: movq %rsi, %rax
188192
; WIN64-NEXT: addq $64, %rsp
189193
; WIN64-NEXT: popq %rsi

0 commit comments

Comments
 (0)