Debian Codegraph @

clang/test/CodeGenOpenCL/builtins-amdgcn-fp8.cl

raw
1 // REQUIRES: amdgpu-registered-target
2 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx942 -emit-llvm -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1200 -emit-llvm -o - %s | FileCheck %s
4 // RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx1250 -emit-llvm -o - %s | FileCheck %s
5
6 typedef float v2f __attribute__((ext_vector_type(2)));
7
8 // CHECK-LABEL: @test_cvt_f32_bf8
9 // CHECK: call float @llvm.amdgcn.cvt.f32.bf8(i32 %a, i32 0)
10 void test_cvt_f32_bf8(global int* out, int a)
11 {
12 *out = __builtin_amdgcn_cvt_f32_bf8(a, 0);
13 }
14
15 // CHECK-LABEL: @test_cvt_f32_fp8
16 // CHECK: call float @llvm.amdgcn.cvt.f32.fp8(i32 %a, i32 1)
17 void test_cvt_f32_fp8(global int* out, int a)
18 {
19 *out = __builtin_amdgcn_cvt_f32_fp8(a, 1);
20 }
21
22 // CHECK-LABEL: @test_cvt_pk_f32_bf8
23 // CHECK: call <2 x float> @llvm.amdgcn.cvt.pk.f32.bf8(i32 %a, i1 false)
24 void test_cvt_pk_f32_bf8(global v2f* out, int a)
25 {
26 *out = __builtin_amdgcn_cvt_pk_f32_bf8(a, false);
27 }
28
29 // CHECK-LABEL: @test_cvt_pk_f32_fp8
30 // CHECK: call <2 x float> @llvm.amdgcn.cvt.pk.f32.fp8(i32 %a, i1 true)
31 void test_cvt_pk_f32_fp8(global v2f* out, int a)
32 {
33 *out = __builtin_amdgcn_cvt_pk_f32_fp8(a, true);
34 }
35
36 // CHECK-LABEL: @test_cvt_pk_bf8_f32
37 // CHECK: call i32 @llvm.amdgcn.cvt.pk.bf8.f32(float %a, float %b, i32 %old, i1 false)
38 void test_cvt_pk_bf8_f32(global int* out, int old, float a, float b)
39 {
40 *out = __builtin_amdgcn_cvt_pk_bf8_f32(a, b, old, false);
41 }
42
43 // CHECK-LABEL: @test_cvt_pk_fp8_f32
44 // CHECK: call i32 @llvm.amdgcn.cvt.pk.fp8.f32(float %a, float %b, i32 %old, i1 true)
45 void test_cvt_pk_fp8_f32(global int* out, int old, float a, float b)
46 {
47 *out = __builtin_amdgcn_cvt_pk_fp8_f32(a, b, old, true);
48 }
49
50 // CHECK-LABEL: @test_cvt_sr_bf8_f32
51 // CHECK: call i32 @llvm.amdgcn.cvt.sr.bf8.f32(float %a, i32 %b, i32 %old, i32 2)
52 void test_cvt_sr_bf8_f32(global int* out, int old, float a, int b)
53 {
54 *out = __builtin_amdgcn_cvt_sr_bf8_f32(a, b, old, 2);
55 }
56
57 // CHECK-LABEL: @test_cvt_sr_fp8_f32
58 // CHECK: call i32 @llvm.amdgcn.cvt.sr.fp8.f32(float %a, i32 %b, i32 %old, i32 3)
59 void test_cvt_sr_fp8_f32(global int* out, int old, float a, int b)
60 {
61 *out = __builtin_amdgcn_cvt_sr_fp8_f32(a, b, old, 3);
62 }