xref: /llvm-project/llvm/test/CodeGen/NVPTX/convert-sm89.ll (revision 7e2eb0f83e1cf6861c8fd1f038a88a8ddd851c34)
1b279f6b0SFangrui Song; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_89 -mattr=+ptx81 | FileCheck %s
2b279f6b0SFangrui Song; RUN: %if ptxas-12.1 %{ llc < %s -mtriple=nvptx64 -mcpu=sm_89 -mattr=+ptx81 | %ptxas-verify -arch=sm_89 %}
3865952bbSSergey Kozub
4865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_e4m3x2_f32
5865952bbSSergey Kozubdefine i16 @cvt_rn_e4m3x2_f32(float %f1, float %f2) {
6865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.e4m3x2.f32
7865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.ff.to.e4m3x2.rn(float %f1, float %f2);
8865952bbSSergey Kozub  ret i16 %val
9865952bbSSergey Kozub}
10865952bbSSergey Kozub
11865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_e4m3x2_f32
12865952bbSSergey Kozubdefine i16 @cvt_rn_relu_e4m3x2_f32(float %f1, float %f2) {
13865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.relu.e4m3x2.f32
14865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.ff.to.e4m3x2.rn.relu(float %f1, float %f2);
15865952bbSSergey Kozub  ret i16 %val
16865952bbSSergey Kozub}
17865952bbSSergey Kozub
18865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_e5m2x2_f32
19865952bbSSergey Kozubdefine i16 @cvt_rn_e5m2x2_f32(float %f1, float %f2) {
20865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.e5m2x2.f32
21865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.ff.to.e5m2x2.rn(float %f1, float %f2);
22865952bbSSergey Kozub  ret i16 %val
23865952bbSSergey Kozub}
24865952bbSSergey Kozub
25865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_e5m2x2_f32
26865952bbSSergey Kozubdefine i16 @cvt_rn_relu_e5m2x2_f32(float %f1, float %f2) {
27865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.relu.e5m2x2.f32
28865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.ff.to.e5m2x2.rn.relu(float %f1, float %f2);
29865952bbSSergey Kozub  ret i16 %val
30865952bbSSergey Kozub}
31865952bbSSergey Kozub
32865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_e4m3x2_f16x2
33865952bbSSergey Kozubdefine i16 @cvt_rn_e4m3x2_f16x2(<2 x half> %in) {
34865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.e4m3x2.f16x2
35865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.f16x2.to.e4m3x2.rn(<2 x half> %in);
36865952bbSSergey Kozub  ret i16 %val
37865952bbSSergey Kozub}
38865952bbSSergey Kozub
39865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_e4m3x2_f16x2
40865952bbSSergey Kozubdefine i16 @cvt_rn_relu_e4m3x2_f16x2(<2 x half> %in) {
41865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.relu.e4m3x2.f16x2
42865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.f16x2.to.e4m3x2.rn.relu(<2 x half> %in);
43865952bbSSergey Kozub  ret i16 %val
44865952bbSSergey Kozub}
45865952bbSSergey Kozub
46865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_e5m2x2_f16x2
47865952bbSSergey Kozubdefine i16 @cvt_rn_e5m2x2_f16x2(<2 x half> %in) {
48865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.e5m2x2.f16x2
49865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.f16x2.to.e5m2x2.rn(<2 x half> %in);
50865952bbSSergey Kozub  ret i16 %val
51865952bbSSergey Kozub}
52865952bbSSergey Kozub
53865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_e5m2x2_f16x2
54865952bbSSergey Kozubdefine i16 @cvt_rn_relu_e5m2x2_f16x2(<2 x half> %in) {
55865952bbSSergey Kozub; CHECK: cvt.rn.satfinite.relu.e5m2x2.f16x2
56865952bbSSergey Kozub  %val = call i16 @llvm.nvvm.f16x2.to.e5m2x2.rn.relu(<2 x half> %in);
57865952bbSSergey Kozub  ret i16 %val
58865952bbSSergey Kozub}
59865952bbSSergey Kozub
60865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_f16x2_e4m3x2
61865952bbSSergey Kozubdefine <2 x half> @cvt_rn_f16x2_e4m3x2(i16 %in) {
62865952bbSSergey Kozub; CHECK: cvt.rn.f16x2.e4m3x2
63865952bbSSergey Kozub  %val = call <2 x half> @llvm.nvvm.e4m3x2.to.f16x2.rn(i16 %in);
64865952bbSSergey Kozub  ret <2 x half> %val
65865952bbSSergey Kozub}
66865952bbSSergey Kozub
67865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_f16x2_e4m3x2
68865952bbSSergey Kozubdefine <2 x half> @cvt_rn_relu_f16x2_e4m3x2(i16 %in) {
69865952bbSSergey Kozub; CHECK: cvt.rn.relu.f16x2.e4m3x2
70865952bbSSergey Kozub  %val = call <2 x half> @llvm.nvvm.e4m3x2.to.f16x2.rn.relu(i16 %in);
71865952bbSSergey Kozub  ret <2 x half> %val
72865952bbSSergey Kozub}
73865952bbSSergey Kozub
74865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_f16x2_e5m2x2
75865952bbSSergey Kozubdefine <2 x half> @cvt_rn_f16x2_e5m2x2(i16 %in) {
76865952bbSSergey Kozub; CHECK: cvt.rn.f16x2.e5m2x2
77865952bbSSergey Kozub  %val = call <2 x half> @llvm.nvvm.e5m2x2.to.f16x2.rn(i16 %in);
78865952bbSSergey Kozub  ret <2 x half> %val
79865952bbSSergey Kozub}
80865952bbSSergey Kozub
81865952bbSSergey Kozub; CHECK-LABEL: cvt_rn_relu_f16x2_e5m2x2
82865952bbSSergey Kozubdefine <2 x half> @cvt_rn_relu_f16x2_e5m2x2(i16 %in) {
83865952bbSSergey Kozub; CHECK: cvt.rn.relu.f16x2.e5m2x2
84865952bbSSergey Kozub  %val = call <2 x half> @llvm.nvvm.e5m2x2.to.f16x2.rn.relu(i16 %in);
85865952bbSSergey Kozub  ret <2 x half> %val
86865952bbSSergey Kozub}
87*7e2eb0f8SDurgadoss R
88*7e2eb0f8SDurgadoss R; CHECK-LABEL: cvt_rna_satfinite_tf32_f32
89*7e2eb0f8SDurgadoss Rdefine i32 @cvt_rna_satfinite_tf32_f32(float %f1) {
90*7e2eb0f8SDurgadoss R; CHECK: cvt.rna.satfinite.tf32.f32
91*7e2eb0f8SDurgadoss R  %val = call i32 @llvm.nvvm.f2tf32.rna.satfinite(float %f1)
92*7e2eb0f8SDurgadoss R  ret i32 %val
93*7e2eb0f8SDurgadoss R}
94