Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18096580
D16532.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16532.diff
View Options
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -9022,7 +9022,8 @@
return DAG.getNode(ISD::FABS, SDLoc(N), VT, N0);
// copysign(x, copysign(y,z)) -> copysign(x, z)
- if (N1.getOpcode() == ISD::FCOPYSIGN)
+ if (DAG.getTarget().Options.UnsafeFPMath &&
+ N1.getOpcode() == ISD::FCOPYSIGN)
return DAG.getNode(ISD::FCOPYSIGN, SDLoc(N), VT,
N0, N1.getOperand(1));
Index: test/CodeGen/X86/sse-fcopysign.ll
===================================================================
--- test/CodeGen/X86/sse-fcopysign.ll
+++ test/CodeGen/X86/sse-fcopysign.ll
@@ -152,3 +152,19 @@
declare float @llvm.copysign.f32(float %Mag, float %Sgn)
declare double @llvm.copysign.f64(double %Mag, double %Sgn)
+
+;
+; Unsafe transformations
+;
+
+define double @safe(float %a, double %b) "unsafe-fp-math"="false" {
+; CHECK-LABEL: safe:
+; CHECK: andps
+; CHECK-NEXT: orps
+; CHECK: cvtss2sd
+
+ %r1 = call float @llvm.copysign.f32(float 1.000000e+00, float %a)
+ %r2 = fpext float %r1 to double
+ %r3 = call double @llvm.copysign.f64(double %b, double %r2)
+ ret double %r3
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Aug 9, 7:50 AM (11 h, 46 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9076910
Default Alt Text
D16532.diff (1 KB)
Attached To
Mode
D16532: Unsafe copysign xform in DAGCombiner
Attached
Detach File
Event Timeline
Log In to Comment