Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
mlir::TypeRange{newInTypes}.drop_front(dropFront), newResTys));
newCall = rewriter->create<fir::CallOp>(loc, newResTys, newOpers);
}
newCall.setFastmathAttr(callOp.getFastmathAttr());
// Always set ABI argument attributes on call operations, even when
// direct, as required by
// https://llvm.org/docs/LangRef.html#parameter-attributes.
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Fir/CUDA/cuda-target-rewrite.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ gpu.module @testmod {
}

// CHECK-LABEL: gpu.func @_QPvcpowdk
// CHECK: %{{.*}} = fir.call @_FortranAzpowk(%{{.*}}, %{{.*}}, %{{.*}}) : (f64, f64, i64) -> tuple<f64, f64>
// CHECK: %{{.*}} = fir.call @_FortranAzpowk(%{{.*}}, %{{.*}}, %{{.*}}) fastmath<contract> : (f64, f64, i64) -> tuple<f64, f64>
// CHECK: func.func private @_FortranAzpowk(f64, f64, i64) -> tuple<f64, f64> attributes {fir.bindc_name = "_FortranAzpowk", fir.runtime}
}

Expand Down
8 changes: 8 additions & 0 deletions flang/test/Fir/target-rewrite-fmfs.fir
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: fir-opt --target-rewrite %s | FileCheck %s

// CHECK-LABEL: func.func @libm_preserves_fmfs
func.func @libm_preserves_fmfs(%arg0 : complex<f32>) -> complex<f32> {
%0 = fir.call @csin(%arg0) fastmath<contract> : (complex<f32>) -> complex<f32>
// CHECK: fir.call @csin(%{{.+}}) fastmath<contract>
return %0 : complex<f32>
}
8 changes: 4 additions & 4 deletions flang/test/Fir/target-rewrite-selective.fir
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
// r = test2(value)
// end function

// CMPLXOFF-DAG: fir.call @_QPtest1({{.*}}, {{.*}}, {{.*}}) : (!fir.ref<!fir.char<1,?>>, complex<f32>, i64) -> complex<f32>
// CMPLXOFF-DAG: fir.call @_QPtest2({{.*}}, {{.*}}, {{.*}}) : (!fir.ref<!fir.char<1,10>>, index, complex<f32>) -> !fir.boxchar<1>
// CMPLXOFF-DAG: fir.call @_QPtest1({{.*}}, {{.*}}, {{.*}}) fastmath<contract> : (!fir.ref<!fir.char<1,?>>, complex<f32>, i64) -> complex<f32>
// CMPLXOFF-DAG: fir.call @_QPtest2({{.*}}, {{.*}}, {{.*}}) fastmath<contract> : (!fir.ref<!fir.char<1,10>>, index, complex<f32>) -> !fir.boxchar<1>
// CMPLXOFF-DAG: func.func private @_QPtest1(!fir.ref<!fir.char<1,?>>, complex<f32>, i64) -> complex<f32>
// CMPLXOFF-DAG: func.func private @_QPtest2(!fir.ref<!fir.char<1,10>>, index, complex<f32>) -> !fir.boxchar<1>

// CHAROFF-DAG: fir.call @_QPtest1({{.*}}, {{.*}}) : (!fir.boxchar<1>, !fir.vector<2:f32>) -> !fir.vector<2:f32>
// CHAROFF-DAG: fir.call @_QPtest2({{.*}}, {{.*}}, {{.*}}) : (!fir.ref<!fir.char<1,10>>, index, !fir.vector<2:f32>) -> !fir.boxchar<1>
// CHAROFF-DAG: fir.call @_QPtest1({{.*}}, {{.*}}) fastmath<contract> : (!fir.boxchar<1>, !fir.vector<2:f32>) -> !fir.vector<2:f32>
// CHAROFF-DAG: fir.call @_QPtest2({{.*}}, {{.*}}, {{.*}}) fastmath<contract> : (!fir.ref<!fir.char<1,10>>, index, !fir.vector<2:f32>) -> !fir.boxchar<1>
// CHAROFF-DAG: func.func private @_QPtest1(!fir.boxchar<1>, !fir.vector<2:f32>) -> !fir.vector<2:f32>
// CHAROFF-DAG: func.func private @_QPtest2(!fir.ref<!fir.char<1,10>>, index, !fir.vector<2:f32>) -> !fir.boxchar<1>

Expand Down
Loading