Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F22962350
D16532.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
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, Oct 31, 11:24 PM (8 h, 37 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
17376941
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