File tree Expand file tree Collapse file tree 2 files changed +25
-6
lines changed
lib/Target/DirectX/DXILWriter Expand file tree Collapse file tree 2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -749,8 +749,8 @@ uint64_t DXILBitcodeWriter::getOptimizationFlags(const Value *V) {
749
749
if (PEO->isExact ())
750
750
Flags |= 1 << bitc::PEO_EXACT;
751
751
} else if (const auto *FPMO = dyn_cast<FPMathOperator>(V)) {
752
- if (FPMO->hasAllowReassoc ())
753
- Flags |= bitc::AllowReassoc ;
752
+ if (FPMO->hasAllowReassoc () || FPMO-> hasAllowContract () )
753
+ Flags |= bitc::UnsafeAlgebra ;
754
754
if (FPMO->hasNoNaNs ())
755
755
Flags |= bitc::NoNaNs;
756
756
if (FPMO->hasNoInfs ())
@@ -759,10 +759,6 @@ uint64_t DXILBitcodeWriter::getOptimizationFlags(const Value *V) {
759
759
Flags |= bitc::NoSignedZeros;
760
760
if (FPMO->hasAllowReciprocal ())
761
761
Flags |= bitc::AllowReciprocal;
762
- if (FPMO->hasAllowContract ())
763
- Flags |= bitc::AllowContract;
764
- if (FPMO->hasApproxFunc ())
765
- Flags |= bitc::ApproxFunc;
766
762
}
767
763
768
764
return Flags;
Original file line number Diff line number Diff line change
1
+ ; RUN: llc %s --filetype=obj -o - | dxil-dis -o - | FileCheck %s
2
+ target triple = "dxil-unknown-shadermodel6.7-library"
3
+
4
+ define float @fma (float %0 , float %1 , float %2 ) #0 {
5
+ ; verify reassoc and contract are converted to fast
6
+ ; CHECK: %4 = fmul fast float %0, %1
7
+ %4 = fmul reassoc float %0 , %1
8
+ ; CHECK-NEXT: %5 = fadd fast float %4, %2
9
+ %5 = fadd contract float %4 , %2
10
+ ; verify these are converted to a single fast flag
11
+ ; CHECK-NEXT: %6 = fmul fast float %0, %1
12
+ %6 = fmul reassoc contract float %0 , %1
13
+ ; verify these flags are maintained
14
+ ; CHECK-NEXT: %7 = fadd nnan ninf nsz arcp float %0, %1
15
+ %7 = fadd nnan ninf nsz arcp float %0 , %1
16
+ ; verify that afn is removed
17
+ ; CHECK-NEXT: %8 = fmul float %0, %1
18
+ %8 = fmul afn float %0 , %1
19
+ ret float %5
20
+ }
21
+
22
+ attributes #0 = { norecurse nounwind readnone willreturn "disable-tail-calls" ="false" "waveops-include-helper-lanes" "fp32-denorm-mode" ="any" "hlsl.export" }
23
+
You can’t perform that action at this time.
0 commit comments