72 lines · plain
1; RUN: mlir-translate -import-llvm -split-input-file %s | FileCheck %s2 3; CHECK-LABEL: @fastmath_inst4define void @fastmath_inst(float %arg1, float %arg2, i1 %arg3) {5 ; CHECK: llvm.fadd %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<nnan, ninf>} : f326 %1 = fadd nnan ninf float %arg1, %arg27 ; CHECK: llvm.fsub %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<nsz>} : f328 %2 = fsub nsz float %arg1, %arg29 ; CHECK: llvm.fmul %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<arcp, contract>} : f3210 %3 = fmul arcp contract float %arg1, %arg211 ; CHECK: llvm.fdiv %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<afn, reassoc>} : f3212 %4 = fdiv afn reassoc float %arg1, %arg213 ; CHECK: llvm.fneg %{{.*}} {fastmathFlags = #llvm.fastmath<fast>} : f3214 %5 = fneg fast float %arg115 ; CHECK: llvm.select %{{.*}}, %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<contract>} : i1, f3216 %6 = select contract i1 %arg3, float %arg1, float %arg217 ret void18}19 20; // -----21 22; CHECK-LABEL: @fastmath_fcmp23define void @fastmath_fcmp(float %arg1, float %arg2) {24 ; CHECK: llvm.fcmp "oge" %{{.*}}, %{{.*}} {fastmathFlags = #llvm.fastmath<nsz>} : f3225 %1 = fcmp nsz oge float %arg1, %arg226 ret void27}28 29; // -----30 31declare float @fn(float)32 33; CHECK-LABEL: @fastmath_call34define void @fastmath_call(float %arg1) {35 ; CHECK: llvm.call @fn(%{{.*}}) {fastmathFlags = #llvm.fastmath<ninf>} : (f32) -> f3236 %1 = call ninf float @fn(float %arg1)37 ret void38}39 40; // -----41 42declare float @llvm.exp.f32(float)43declare float @llvm.powi.f32.i32(float, i32)44declare float @llvm.pow.f32(float, float)45declare float @llvm.fmuladd.f32(float, float, float)46declare float @llvm.vector.reduce.fmin.v2f32(<2 x float>)47declare float @llvm.vector.reduce.fmax.v2f32(<2 x float>)48declare float @llvm.vector.reduce.fminimum.v2f32(<2 x float>)49declare float @llvm.vector.reduce.fmaximum.v2f32(<2 x float>)50 51; CHECK-LABEL: @fastmath_intr52define void @fastmath_intr(float %arg1, i32 %arg2, <2 x float> %arg3) {53 ; CHECK: llvm.intr.exp(%{{.*}}) {fastmathFlags = #llvm.fastmath<nnan, ninf>} : (f32) -> f3254 %1 = call nnan ninf float @llvm.exp.f32(float %arg1)55 ; CHECK: llvm.intr.powi(%{{.*}}, %{{.*}}) {fastmathFlags = #llvm.fastmath<fast>} : (f32, i32) -> f3256 %2 = call fast float @llvm.powi.f32.i32(float %arg1, i32 %arg2)57 ; CHECK: llvm.intr.pow(%{{.*}}, %{{.*}}) {fastmathFlags = #llvm.fastmath<fast>} : (f32, f32) -> f3258 %3 = call fast float @llvm.pow.f32(float %arg1, float %arg1)59 ; CHECK: llvm.intr.fmuladd(%{{.*}}, %{{.*}}, %{{.*}}) {fastmathFlags = #llvm.fastmath<fast>} : (f32, f32, f32) -> f3260 %4 = call fast float @llvm.fmuladd.f32(float %arg1, float %arg1, float %arg1)61 ; CHECK: %{{.*}} = llvm.intr.vector.reduce.fmin({{.*}}) {fastmathFlags = #llvm.fastmath<nnan>} : (vector<2xf32>) -> f3262 %5 = call nnan float @llvm.vector.reduce.fmin.v2f32(<2 x float> %arg3)63 ; CHECK: %{{.*}} = llvm.intr.vector.reduce.fmax({{.*}}) {fastmathFlags = #llvm.fastmath<nnan>} : (vector<2xf32>) -> f3264 %6 = call nnan float @llvm.vector.reduce.fmax.v2f32(<2 x float> %arg3)65 ; CHECK: %{{.*}} = llvm.intr.vector.reduce.fminimum({{.*}}) {fastmathFlags = #llvm.fastmath<nnan>} : (vector<2xf32>) -> f3266 %7 = call nnan float @llvm.vector.reduce.fminimum.v2f32(<2 x float> %arg3)67 ; CHECK: %{{.*}} = llvm.intr.vector.reduce.fmaximum({{.*}}) {fastmathFlags = #llvm.fastmath<nnan>} : (vector<2xf32>) -> f3268 %8 = call nnan float @llvm.vector.reduce.fmaximum.v2f32(<2 x float> %arg3)69 70 ret void71}72