24 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3// CHECK-LABEL: @convert_f32x2_to_f4x2_e2m14llvm.func @convert_f32x2_to_f4x2_e2m1(%srcA : f32, %srcB : f32) {5 // CHECK: %[[res1:.*]] = call i16 @llvm.nvvm.ff.to.e2m1x2.rn.satfinite(float %{{.*}}, float %{{.*}})6 // CHECK-NEXT: %{{.*}} = trunc i16 %[[res1]] to i87 %res1 = nvvm.convert.f32x2.to.f4x2 %srcA, %srcB : i8 (f4E2M1FN)8 // CHECK: %[[res2:.*]] = call i16 @llvm.nvvm.ff.to.e2m1x2.rn.relu.satfinite(float %{{.*}}, float %{{.*}})9 // CHECK-NEXT: %{{.*}} = trunc i16 %[[res2]] to i810 %res2 = nvvm.convert.f32x2.to.f4x2 %srcA, %srcB {relu = true} : i8 (f4E2M1FN)11 llvm.return12}13 14// CHECK-LABEL: @convert_f4x2_to_f16x215llvm.func @convert_f4x2_to_f16x2(%src : i8) {16 // CHECK: %[[res1:.*]] = zext i8 %{{.*}} to i1617 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e2m1x2.to.f16x2.rn(i16 %[[res1]])18 %res1 = nvvm.convert.f4x2.to.f16x2 %src : i8 (f4E2M1FN)-> vector<2xf16>19 // CHECK: %[[res2:.*]] = zext i8 %{{.*}} to i1620 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e2m1x2.to.f16x2.rn.relu(i16 %[[res2]])21 %res2 = nvvm.convert.f4x2.to.f16x2 %src {relu = true} : i8 (f4E2M1FN)-> vector<2xf16>22 llvm.return23}24