46 lines · plain
1// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s2 3// CHECK-LABEL: @convert_f32x2_to_fp6x2_packed4llvm.func @convert_f32x2_to_fp6x2_packed(%srcA : f32, %srcB : f32) {5 //CHECK: %{{.*}} = call i16 @llvm.nvvm.ff.to.e2m3x2.rn.satfinite(float %{{.*}}, float %{{.*}})6 %res1 = nvvm.convert.f32x2.to.f6x2 %srcA, %srcB : i16 (f6E2M3FN)7 //CHECK: %{{.*}} = call i16 @llvm.nvvm.ff.to.e3m2x2.rn.satfinite(float %{{.*}}, float %{{.*}})8 %res2 = nvvm.convert.f32x2.to.f6x2 %srcA, %srcB : i16 (f6E3M2FN)9 llvm.return10}11 12// CHECK-LABEL: @convert_f32x2_to_fp6x2_vector13llvm.func @convert_f32x2_to_fp6x2_vector(%srcA : f32, %srcB : f32) {14 //CHECK: %[[res0:.*]] = call i16 @llvm.nvvm.ff.to.e2m3x2.rn.satfinite(float %{{.*}}, float %{{.*}})15 //CHECK-NEXT: %{{.*}} = bitcast i16 %[[res0]] to <2 x i8>16 %res1 = nvvm.convert.f32x2.to.f6x2 %srcA, %srcB : vector<2xi8> (f6E2M3FN)17 //CHECK: %[[res1:.*]] = call i16 @llvm.nvvm.ff.to.e3m2x2.rn.satfinite(float %{{.*}}, float %{{.*}})18 //CHECK-NEXT: %{{.*}} = bitcast i16 %[[res1]] to <2 x i8>19 %res2 = nvvm.convert.f32x2.to.f6x2 %srcA, %srcB : vector<2xi8> (f6E3M2FN)20 llvm.return21}22 23// -----24 25// CHECK-LABEL: @convert_f6x2_to_f16x2_e2m326llvm.func @convert_f6x2_to_f16x2_e2m3(%src : vector<2xi8>) {27 // CHECK: %[[res1:.*]] = bitcast <2 x i8> %{{.*}} to i1628 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e2m3x2.to.f16x2.rn(i16 %[[res1]])29 %res1 = nvvm.convert.f6x2.to.f16x2 %src : vector<2xi8> (f6E2M3FN)-> vector<2xf16>30 // CHECK: %[[res2:.*]] = bitcast <2 x i8> %{{.*}} to i1631 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e2m3x2.to.f16x2.rn.relu(i16 %[[res2]])32 %res2 = nvvm.convert.f6x2.to.f16x2 %src {relu = true} : vector<2xi8> (f6E2M3FN)-> vector<2xf16>33 llvm.return34}35 36// CHECK-LABEL: @convert_f6x2_to_f16x2_e3m237llvm.func @convert_f6x2_to_f16x2_e3m2(%src : vector<2xi8>) {38 // CHECK: %[[res1:.*]] = bitcast <2 x i8> %{{.*}} to i1639 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e3m2x2.to.f16x2.rn(i16 %[[res1]])40 %res1 = nvvm.convert.f6x2.to.f16x2 %src : vector<2xi8> (f6E3M2FN)-> vector<2xf16>41 // CHECK: %[[res2:.*]] = bitcast <2 x i8> %{{.*}} to i1642 // CHECK-NEXT: %{{.*}} = call <2 x half> @llvm.nvvm.e3m2x2.to.f16x2.rn.relu(i16 %[[res2]])43 %res2 = nvvm.convert.f6x2.to.f16x2 %src {relu = true} : vector<2xi8> (f6E3M2FN)-> vector<2xf16>44 llvm.return45}46