| 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=4 -mvscale-max=4 -O1 -emit-llvm -o - %s | FileCheck %s |
| 3 |
|
| 4 |
// REQUIRES: riscv-registered-target |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
typedef __rvv_int8m1_t vint8m1_t; |
| 9 |
typedef __rvv_uint8m1_t vuint8m1_t; |
| 10 |
typedef __rvv_int16m1_t vint16m1_t; |
| 11 |
typedef __rvv_uint16m1_t vuint16m1_t; |
| 12 |
typedef __rvv_int32m1_t vint32m1_t; |
| 13 |
typedef __rvv_uint32m1_t vuint32m1_t; |
| 14 |
typedef __rvv_int64m1_t vint64m1_t; |
| 15 |
typedef __rvv_uint64m1_t vuint64m1_t; |
| 16 |
typedef __rvv_float32m1_t vfloat32m1_t; |
| 17 |
typedef __rvv_float64m1_t vfloat64m1_t; |
| 18 |
|
| 19 |
typedef __rvv_bool1_t vbool1_t; |
| 20 |
typedef __rvv_bool4_t vbool4_t; |
| 21 |
typedef __rvv_bool32_t vbool32_t; |
| 22 |
|
| 23 |
typedef vint64m1_t fixed_int64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); |
| 24 |
typedef vfloat64m1_t fixed_float64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); |
| 25 |
|
| 26 |
typedef vint32m1_t fixed_int32m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); |
| 27 |
typedef vfloat64m1_t fixed_float64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); |
| 28 |
typedef int32_t gnu_int32m1_t __attribute__((vector_size(__riscv_v_fixed_vlen / 8))); |
| 29 |
|
| 30 |
typedef vbool1_t fixed_bool1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen))); |
| 31 |
typedef vbool4_t fixed_bool4_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/4))); |
| 32 |
typedef vbool32_t fixed_bool32_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/32))); |
| 33 |
|
| 34 |
// CHECK-LABEL: @to_vint32m1_t( |
| 35 |
// CHECK-NEXT: entry: |
| 36 |
// CHECK-NEXT: ret <vscale x 2 x i32> [[TYPE_COERCE:%.*]] |
| 37 |
// |
| 38 |
vint32m1_t to_vint32m1_t(fixed_int32m1_t type) { |
| 39 |
return type; |
| 40 |
} |
| 41 |
|
| 42 |
// CHECK-LABEL: @from_vint32m1_t( |
| 43 |
// CHECK-NEXT: entry: |
| 44 |
// CHECK-NEXT: ret <vscale x 2 x i32> [[TYPE:%.*]] |
| 45 |
// |
| 46 |
fixed_int32m1_t from_vint32m1_t(vint32m1_t type) { |
| 47 |
return type; |
| 48 |
} |
| 49 |
|
| 50 |
// CHECK-LABEL: @to_vfloat64m1_t( |
| 51 |
// CHECK-NEXT: entry: |
| 52 |
// CHECK-NEXT: ret <vscale x 1 x double> [[TYPE_COERCE:%.*]] |
| 53 |
// |
| 54 |
vfloat64m1_t to_vfloat64m1_t(fixed_float64m1_t type) { |
| 55 |
return type; |
| 56 |
} |
| 57 |
|
| 58 |
// CHECK-LABEL: @from_vfloat64m1_t( |
| 59 |
// CHECK-NEXT: entry: |
| 60 |
// CHECK-NEXT: ret <vscale x 1 x double> [[TYPE:%.*]] |
| 61 |
// |
| 62 |
fixed_float64m1_t from_vfloat64m1_t(vfloat64m1_t type) { |
| 63 |
return type; |
| 64 |
} |
| 65 |
|
| 66 |
// CHECK-LABEL: @from_vbool1_t( |
| 67 |
// CHECK-NEXT: entry: |
| 68 |
// CHECK-NEXT: ret <vscale x 64 x i1> [[TYPE:%.*]] |
| 69 |
// |
| 70 |
fixed_bool1_t from_vbool1_t(vbool1_t type) { |
| 71 |
return type; |
| 72 |
} |
| 73 |
|
| 74 |
// CHECK-LABEL: @to_vbool1_t( |
| 75 |
// CHECK-NEXT: entry: |
| 76 |
// CHECK-NEXT: ret <vscale x 64 x i1> [[TMP0:%.*]] |
| 77 |
// |
| 78 |
vbool1_t to_vbool1_t(fixed_bool1_t type) { |
| 79 |
return type; |
| 80 |
} |
| 81 |
|
| 82 |
// CHECK-LABEL: @from_vbool4_t( |
| 83 |
// CHECK-NEXT: entry: |
| 84 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE:%.*]] |
| 85 |
// |
| 86 |
fixed_bool4_t from_vbool4_t(vbool4_t type) { |
| 87 |
return type; |
| 88 |
} |
| 89 |
|
| 90 |
// CHECK-LABEL: @to_vbool4_t( |
| 91 |
// CHECK-NEXT: entry: |
| 92 |
// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0:%.*]] |
| 93 |
// |
| 94 |
vbool4_t to_vbool4_t(fixed_bool4_t type) { |
| 95 |
return type; |
| 96 |
} |
| 97 |
|
| 98 |
// CHECK-LABEL: @from_vbool32_t( |
| 99 |
// CHECK-NEXT: entry: |
| 100 |
// CHECK-NEXT: [[SAVED_VALUE:%.*]] = alloca <vscale x 2 x i1>, align 1 |
| 101 |
// CHECK-NEXT: [[RETVAL_COERCE:%.*]] = alloca <vscale x 2 x i1>, align 1 |
| 102 |
// CHECK-NEXT: store <vscale x 2 x i1> [[TYPE:%.*]], ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA4:![0-9]+]] |
| 103 |
// CHECK-NEXT: [[TMP0:%.*]] = load <1 x i8>, ptr [[SAVED_VALUE]], align 1, !tbaa [[TBAA8:![0-9]+]] |
| 104 |
// CHECK-NEXT: store <1 x i8> [[TMP0]], ptr [[RETVAL_COERCE]], align 1 |
| 105 |
// CHECK-NEXT: [[TMP1:%.*]] = load <vscale x 2 x i1>, ptr [[RETVAL_COERCE]], align 1 |
| 106 |
// CHECK-NEXT: ret <vscale x 2 x i1> [[TMP1]] |
| 107 |
// |
| 108 |
fixed_bool32_t from_vbool32_t(vbool32_t type) { |
| 109 |
return type; |
| 110 |
} |
| 111 |
|
| 112 |
// CHECK-LABEL: @to_vbool32_t( |
| 113 |
// CHECK-NEXT: entry: |
| 114 |
// CHECK-NEXT: ret <vscale x 2 x i1> [[TYPE_COERCE:%.*]] |
| 115 |
// |
| 116 |
vbool32_t to_vbool32_t(fixed_bool32_t type) { |
| 117 |
return type; |
| 118 |
} |
| 119 |
|
| 120 |
// CHECK-LABEL: @to_vint32m1_t__from_gnu_int32m1_t( |
| 121 |
// CHECK-NEXT: entry: |
| 122 |
// CHECK-NEXT: [[TYPE:%.*]] = load <8 x i32>, ptr [[TMP0:%.*]], align 32, !tbaa [[TBAA8]] |
| 123 |
// CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 2 x i32> @llvm.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32> undef, <8 x i32> [[TYPE]], i64 0) |
| 124 |
// CHECK-NEXT: ret <vscale x 2 x i32> [[CAST_SCALABLE]] |
| 125 |
// |
| 126 |
vint32m1_t to_vint32m1_t__from_gnu_int32m1_t(gnu_int32m1_t type) { |
| 127 |
return type; |
| 128 |
} |
| 129 |
|
| 130 |
// CHECK-LABEL: @from_vint32m1_t__to_gnu_int32m1_t( |
| 131 |
// CHECK-NEXT: entry: |
| 132 |
// CHECK-NEXT: [[CAST_FIXED:%.*]] = tail call <8 x i32> @llvm.vector.extract.v8i32.nxv2i32(<vscale x 2 x i32> [[TYPE:%.*]], i64 0) |
| 133 |
// CHECK-NEXT: store <8 x i32> [[CAST_FIXED]], ptr [[AGG_RESULT:%.*]], align 32, !tbaa [[TBAA8]] |
| 134 |
// CHECK-NEXT: ret void |
| 135 |
// |
| 136 |
gnu_int32m1_t from_vint32m1_t__to_gnu_int32m1_t(vint32m1_t type) { |
| 137 |
return type; |
| 138 |
} |
| 139 |
|
| 140 |
// CHECK-LABEL: @to_fixed_int32m1_t__from_gnu_int32m1_t( |
| 141 |
// CHECK-NEXT: entry: |
| 142 |
// CHECK-NEXT: [[TYPE:%.*]] = load <8 x i32>, ptr [[TMP0:%.*]], align 32, !tbaa [[TBAA8]] |
| 143 |
// CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 2 x i32> @llvm.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32> undef, <8 x i32> [[TYPE]], i64 0) |
| 144 |
// CHECK-NEXT: ret <vscale x 2 x i32> [[CAST_SCALABLE]] |
| 145 |
// |
| 146 |
fixed_int32m1_t to_fixed_int32m1_t__from_gnu_int32m1_t(gnu_int32m1_t type) { |
| 147 |
return type; |
| 148 |
} |
| 149 |
|
| 150 |
// CHECK-LABEL: @from_fixed_int32m1_t__to_gnu_int32m1_t( |
| 151 |
// CHECK-NEXT: entry: |
| 152 |
// CHECK-NEXT: [[TYPE:%.*]] = tail call <8 x i32> @llvm.vector.extract.v8i32.nxv2i32(<vscale x 2 x i32> [[TYPE_COERCE:%.*]], i64 0) |
| 153 |
// CHECK-NEXT: store <8 x i32> [[TYPE]], ptr [[AGG_RESULT:%.*]], align 32, !tbaa [[TBAA8]] |
| 154 |
// CHECK-NEXT: ret void |
| 155 |
// |
| 156 |
gnu_int32m1_t from_fixed_int32m1_t__to_gnu_int32m1_t(fixed_int32m1_t type) { |
| 157 |
return type; |
| 158 |
} |