[SCFToGPU] Convert scf.parallel+scf.reduce to gpu.all_reduce (#122782)
[llvm-project.git] / clang / test / CodeGen / RISCV / attr-riscv-rvv-vector-bits-less-8-cast.c
blobf0fa7e8d07b4d36c39a3d4d78c4a4d5fbc014717
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=1 -mvscale-max=1 -O1 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-64
3 // RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=2 -mvscale-max=2 -O1 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-128
5 // REQUIRES: riscv-registered-target
7 #include <stdint.h>
9 typedef __rvv_bool8_t vbool8_t;
10 typedef __rvv_bool16_t vbool16_t;
11 typedef __rvv_bool32_t vbool32_t;
12 typedef __rvv_bool64_t vbool64_t;
13 typedef vbool8_t fixed_bool8_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/8)));
14 typedef vbool16_t fixed_bool16_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/16)));
15 typedef vbool32_t fixed_bool32_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/32)));
16 typedef vbool64_t fixed_bool64_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/64)));
18 // CHECK-64-LABEL: @from_vbool8_t(
19 // CHECK-64-NEXT: entry:
20 // CHECK-64-NEXT: ret <vscale x 8 x i1> [[TYPE:%.*]]
22 // CHECK-128-LABEL: @from_vbool8_t(
23 // CHECK-128-NEXT: entry:
24 // CHECK-128-NEXT: ret <vscale x 8 x i1> [[TYPE:%.*]]
26 fixed_bool8_t from_vbool8_t(vbool8_t type) {
27 return type;
30 // CHECK-64-LABEL: @from_vbool16_t(
31 // CHECK-64-NEXT: entry:
32 // CHECK-64-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 4 x i1>, align 1
33 // CHECK-64-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 4 x i1>, align 1
34 // CHECK-64-NEXT: store <vscale x 4 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA6:![0-9]+]]
35 // CHECK-64-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10:![0-9]+]]
36 // CHECK-64-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
37 // CHECK-64-NEXT: [[TMP1:%.*]] = load <vscale x 4 x i1>, ptr [[RETVAL_COERCE]], align 1
38 // CHECK-64-NEXT: ret <vscale x 4 x i1> [[TMP1]]
40 // CHECK-128-LABEL: @from_vbool16_t(
41 // CHECK-128-NEXT: entry:
42 // CHECK-128-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 4 x i1>, align 1
43 // CHECK-128-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 4 x i1>, align 1
44 // CHECK-128-NEXT: store <vscale x 4 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA6:![0-9]+]]
45 // CHECK-128-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10:![0-9]+]]
46 // CHECK-128-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
47 // CHECK-128-NEXT: [[TMP1:%.*]] = load <vscale x 4 x i1>, ptr [[RETVAL_COERCE]], align 1
48 // CHECK-128-NEXT: ret <vscale x 4 x i1> [[TMP1]]
50 fixed_bool16_t from_vbool16_t(vbool16_t type) {
51 return type;
53 // CHECK-64-LABEL: @from_vbool32_t(
54 // CHECK-64-NEXT: entry:
55 // CHECK-64-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 2 x i1>, align 1
56 // CHECK-64-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 2 x i1>, align 1
57 // CHECK-64-NEXT: store <vscale x 2 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA11:![0-9]+]]
58 // CHECK-64-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10]]
59 // CHECK-64-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
60 // CHECK-64-NEXT: [[TMP1:%.*]] = load <vscale x 2 x i1>, ptr [[RETVAL_COERCE]], align 1
61 // CHECK-64-NEXT: ret <vscale x 2 x i1> [[TMP1]]
63 // CHECK-128-LABEL: @from_vbool32_t(
64 // CHECK-128-NEXT: entry:
65 // CHECK-128-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 2 x i1>, align 1
66 // CHECK-128-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 2 x i1>, align 1
67 // CHECK-128-NEXT: store <vscale x 2 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA11:![0-9]+]]
68 // CHECK-128-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10]]
69 // CHECK-128-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
70 // CHECK-128-NEXT: [[TMP1:%.*]] = load <vscale x 2 x i1>, ptr [[RETVAL_COERCE]], align 1
71 // CHECK-128-NEXT: ret <vscale x 2 x i1> [[TMP1]]
73 fixed_bool32_t from_vbool32_t(vbool32_t type) {
74 return type;
77 // CHECK-64-LABEL: @to_vbool32_t(
78 // CHECK-64-NEXT: entry:
79 // CHECK-64-NEXT: ret <vscale x 2 x i1> [[TYPE_COERCE:%.*]]
81 // CHECK-128-LABEL: @to_vbool32_t(
82 // CHECK-128-NEXT: entry:
83 // CHECK-128-NEXT: ret <vscale x 2 x i1> [[TYPE_COERCE:%.*]]
85 vbool32_t to_vbool32_t(fixed_bool32_t type) {
86 return type;
89 // CHECK-64-LABEL: @from_vbool64_t(
90 // CHECK-64-NEXT: entry:
91 // CHECK-64-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 1 x i1>, align 1
92 // CHECK-64-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 1 x i1>, align 1
93 // CHECK-64-NEXT: store <vscale x 1 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA13:![0-9]+]]
94 // CHECK-64-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10]]
95 // CHECK-64-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
96 // CHECK-64-NEXT: [[TMP1:%.*]] = load <vscale x 1 x i1>, ptr [[RETVAL_COERCE]], align 1
97 // CHECK-64-NEXT: ret <vscale x 1 x i1> [[TMP1]]
99 // CHECK-128-LABEL: @from_vbool64_t(
100 // CHECK-128-NEXT: entry:
101 // CHECK-128-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 1 x i1>, align 1
102 // CHECK-128-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 1 x i1>, align 1
103 // CHECK-128-NEXT: store <vscale x 1 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA13:![0-9]+]]
104 // CHECK-128-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA10]]
105 // CHECK-128-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1
106 // CHECK-128-NEXT: [[TMP1:%.*]] = load <vscale x 1 x i1>, ptr [[RETVAL_COERCE]], align 1
107 // CHECK-128-NEXT: ret <vscale x 1 x i1> [[TMP1]]
109 fixed_bool64_t from_vbool64_t(vbool64_t type) {
110 return type;
113 // CHECK-64-LABEL: @to_vbool64_t(
114 // CHECK-64-NEXT: entry:
115 // CHECK-64-NEXT: ret <vscale x 1 x i1> [[TYPE_COERCE:%.*]]
117 // CHECK-128-LABEL: @to_vbool64_t(
118 // CHECK-128-NEXT: entry:
119 // CHECK-128-NEXT: ret <vscale x 1 x i1> [[TYPE_COERCE:%.*]]
121 vbool64_t to_vbool64_t(fixed_bool64_t type) {
122 return type;