|
| 1 | +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py |
| 2 | +// RUN: %clang_cc1 -triple thumbv8.1m.main-arm-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -S -emit-llvm -o - %s | opt -S -sroa | FileCheck %s |
| 3 | +// RUN: %clang_cc1 -triple thumbv8.1m.main-arm-none-eabi -target-feature +mve.fp -mfloat-abi hard -fallow-half-arguments-and-returns -O0 -disable-O0-optnone -DPOLYMORPHIC -S -emit-llvm -o - %s | opt -S -sroa | FileCheck %s |
| 4 | + |
| 5 | +#include <arm_mve.h> |
| 6 | + |
| 7 | +// CHECK-LABEL: @test_vfmaq_f16( |
| 8 | +// CHECK-NEXT: entry: |
| 9 | +// CHECK-NEXT: [[TMP0:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> [[B:%.*]], <8 x half> [[C:%.*]], <8 x half> [[A:%.*]]) |
| 10 | +// CHECK-NEXT: ret <8 x half> [[TMP0]] |
| 11 | +// |
| 12 | +float16x8_t test_vfmaq_f16(float16x8_t a, float16x8_t b, float16x8_t c) { |
| 13 | +#ifdef POLYMORPHIC |
| 14 | + return vfmaq(a, b, c); |
| 15 | +#else /* POLYMORPHIC */ |
| 16 | + return vfmaq_f16(a, b, c); |
| 17 | +#endif /* POLYMORPHIC */ |
| 18 | +} |
| 19 | + |
| 20 | +// CHECK-LABEL: @test_vfmaq_f32( |
| 21 | +// CHECK-NEXT: entry: |
| 22 | +// CHECK-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[B:%.*]], <4 x float> [[C:%.*]], <4 x float> [[A:%.*]]) |
| 23 | +// CHECK-NEXT: ret <4 x float> [[TMP0]] |
| 24 | +// |
| 25 | +float32x4_t test_vfmaq_f32(float32x4_t a, float32x4_t b, float32x4_t c) { |
| 26 | +#ifdef POLYMORPHIC |
| 27 | + return vfmaq(a, b, c); |
| 28 | +#else /* POLYMORPHIC */ |
| 29 | + return vfmaq_f32(a, b, c); |
| 30 | +#endif /* POLYMORPHIC */ |
| 31 | +} |
| 32 | + |
| 33 | +// CHECK-LABEL: @test_vfmaq_n_f16( |
| 34 | +// CHECK-NEXT: entry: |
| 35 | +// CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[C_COERCE:%.*]] to i32 |
| 36 | +// CHECK-NEXT: [[TMP_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 |
| 37 | +// CHECK-NEXT: [[TMP1:%.*]] = bitcast i16 [[TMP_0_EXTRACT_TRUNC]] to half |
| 38 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[TMP1]], i32 0 |
| 39 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer |
| 40 | +// CHECK-NEXT: [[TMP2:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> [[B:%.*]], <8 x half> [[DOTSPLAT]], <8 x half> [[A:%.*]]) |
| 41 | +// CHECK-NEXT: ret <8 x half> [[TMP2]] |
| 42 | +// |
| 43 | +float16x8_t test_vfmaq_n_f16(float16x8_t a, float16x8_t b, float16_t c) { |
| 44 | +#ifdef POLYMORPHIC |
| 45 | + return vfmaq(a, b, c); |
| 46 | +#else /* POLYMORPHIC */ |
| 47 | + return vfmaq_n_f16(a, b, c); |
| 48 | +#endif /* POLYMORPHIC */ |
| 49 | +} |
| 50 | + |
| 51 | +// CHECK-LABEL: @test_vfmaq_n_f32( |
| 52 | +// CHECK-NEXT: entry: |
| 53 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[C:%.*]], i32 0 |
| 54 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer |
| 55 | +// CHECK-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[B:%.*]], <4 x float> [[DOTSPLAT]], <4 x float> [[A:%.*]]) |
| 56 | +// CHECK-NEXT: ret <4 x float> [[TMP0]] |
| 57 | +// |
| 58 | +float32x4_t test_vfmaq_n_f32(float32x4_t a, float32x4_t b, float32_t c) { |
| 59 | +#ifdef POLYMORPHIC |
| 60 | + return vfmaq(a, b, c); |
| 61 | +#else /* POLYMORPHIC */ |
| 62 | + return vfmaq_n_f32(a, b, c); |
| 63 | +#endif /* POLYMORPHIC */ |
| 64 | +} |
| 65 | + |
| 66 | +// CHECK-LABEL: @test_vfmasq_n_f16( |
| 67 | +// CHECK-NEXT: entry: |
| 68 | +// CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[C_COERCE:%.*]] to i32 |
| 69 | +// CHECK-NEXT: [[TMP_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 |
| 70 | +// CHECK-NEXT: [[TMP1:%.*]] = bitcast i16 [[TMP_0_EXTRACT_TRUNC]] to half |
| 71 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[TMP1]], i32 0 |
| 72 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer |
| 73 | +// CHECK-NEXT: [[TMP2:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], <8 x half> [[DOTSPLAT]]) |
| 74 | +// CHECK-NEXT: ret <8 x half> [[TMP2]] |
| 75 | +// |
| 76 | +float16x8_t test_vfmasq_n_f16(float16x8_t a, float16x8_t b, float16_t c) { |
| 77 | +#ifdef POLYMORPHIC |
| 78 | + return vfmasq(a, b, c); |
| 79 | +#else /* POLYMORPHIC */ |
| 80 | + return vfmasq_n_f16(a, b, c); |
| 81 | +#endif /* POLYMORPHIC */ |
| 82 | +} |
| 83 | + |
| 84 | +// CHECK-LABEL: @test_vfmasq_n_f32( |
| 85 | +// CHECK-NEXT: entry: |
| 86 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[C:%.*]], i32 0 |
| 87 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer |
| 88 | +// CHECK-NEXT: [[TMP0:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], <4 x float> [[DOTSPLAT]]) |
| 89 | +// CHECK-NEXT: ret <4 x float> [[TMP0]] |
| 90 | +// |
| 91 | +float32x4_t test_vfmasq_n_f32(float32x4_t a, float32x4_t b, float32_t c) { |
| 92 | +#ifdef POLYMORPHIC |
| 93 | + return vfmasq(a, b, c); |
| 94 | +#else /* POLYMORPHIC */ |
| 95 | + return vfmasq_n_f32(a, b, c); |
| 96 | +#endif /* POLYMORPHIC */ |
| 97 | +} |
| 98 | + |
| 99 | +// CHECK-LABEL: @test_vfmsq_f16( |
| 100 | +// CHECK-NEXT: entry: |
| 101 | +// CHECK-NEXT: [[TMP0:%.*]] = fneg <8 x half> [[C:%.*]] |
| 102 | +// CHECK-NEXT: [[TMP1:%.*]] = call <8 x half> @llvm.fma.v8f16(<8 x half> [[B:%.*]], <8 x half> [[TMP0]], <8 x half> [[A:%.*]]) |
| 103 | +// CHECK-NEXT: ret <8 x half> [[TMP1]] |
| 104 | +// |
| 105 | +float16x8_t test_vfmsq_f16(float16x8_t a, float16x8_t b, float16x8_t c) { |
| 106 | +#ifdef POLYMORPHIC |
| 107 | + return vfmsq(a, b, c); |
| 108 | +#else /* POLYMORPHIC */ |
| 109 | + return vfmsq_f16(a, b, c); |
| 110 | +#endif /* POLYMORPHIC */ |
| 111 | +} |
| 112 | + |
| 113 | +// CHECK-LABEL: @test_vfmsq_f32( |
| 114 | +// CHECK-NEXT: entry: |
| 115 | +// CHECK-NEXT: [[TMP0:%.*]] = fneg <4 x float> [[C:%.*]] |
| 116 | +// CHECK-NEXT: [[TMP1:%.*]] = call <4 x float> @llvm.fma.v4f32(<4 x float> [[B:%.*]], <4 x float> [[TMP0]], <4 x float> [[A:%.*]]) |
| 117 | +// CHECK-NEXT: ret <4 x float> [[TMP1]] |
| 118 | +// |
| 119 | +float32x4_t test_vfmsq_f32(float32x4_t a, float32x4_t b, float32x4_t c) { |
| 120 | +#ifdef POLYMORPHIC |
| 121 | + return vfmsq(a, b, c); |
| 122 | +#else /* POLYMORPHIC */ |
| 123 | + return vfmsq_f32(a, b, c); |
| 124 | +#endif /* POLYMORPHIC */ |
| 125 | +} |
| 126 | + |
| 127 | +// CHECK-LABEL: @test_vfmaq_m_f16( |
| 128 | +// CHECK-NEXT: entry: |
| 129 | +// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32 |
| 130 | +// CHECK-NEXT: [[TMP1:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP0]]) |
| 131 | +// CHECK-NEXT: [[TMP2:%.*]] = call <8 x half> @llvm.arm.mve.fma.predicated.v8f16.v8i1(<8 x half> [[B:%.*]], <8 x half> [[C:%.*]], <8 x half> [[A:%.*]], <8 x i1> [[TMP1]]) |
| 132 | +// CHECK-NEXT: ret <8 x half> [[TMP2]] |
| 133 | +// |
| 134 | +float16x8_t test_vfmaq_m_f16(float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { |
| 135 | +#ifdef POLYMORPHIC |
| 136 | + return vfmaq_m(a, b, c, p); |
| 137 | +#else /* POLYMORPHIC */ |
| 138 | + return vfmaq_m_f16(a, b, c, p); |
| 139 | +#endif /* POLYMORPHIC */ |
| 140 | +} |
| 141 | + |
| 142 | +// CHECK-LABEL: @test_vfmaq_m_f32( |
| 143 | +// CHECK-NEXT: entry: |
| 144 | +// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32 |
| 145 | +// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]]) |
| 146 | +// CHECK-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.fma.predicated.v4f32.v4i1(<4 x float> [[B:%.*]], <4 x float> [[C:%.*]], <4 x float> [[A:%.*]], <4 x i1> [[TMP1]]) |
| 147 | +// CHECK-NEXT: ret <4 x float> [[TMP2]] |
| 148 | +// |
| 149 | +float32x4_t test_vfmaq_m_f32(float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { |
| 150 | +#ifdef POLYMORPHIC |
| 151 | + return vfmaq_m(a, b, c, p); |
| 152 | +#else /* POLYMORPHIC */ |
| 153 | + return vfmaq_m_f32(a, b, c, p); |
| 154 | +#endif /* POLYMORPHIC */ |
| 155 | +} |
| 156 | + |
| 157 | +// CHECK-LABEL: @test_vfmaq_m_n_f16( |
| 158 | +// CHECK-NEXT: entry: |
| 159 | +// CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[C_COERCE:%.*]] to i32 |
| 160 | +// CHECK-NEXT: [[TMP_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 |
| 161 | +// CHECK-NEXT: [[TMP1:%.*]] = bitcast i16 [[TMP_0_EXTRACT_TRUNC]] to half |
| 162 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[TMP1]], i32 0 |
| 163 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer |
| 164 | +// CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32 |
| 165 | +// CHECK-NEXT: [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]]) |
| 166 | +// CHECK-NEXT: [[TMP4:%.*]] = call <8 x half> @llvm.arm.mve.fma.predicated.v8f16.v8i1(<8 x half> [[B:%.*]], <8 x half> [[DOTSPLAT]], <8 x half> [[A:%.*]], <8 x i1> [[TMP3]]) |
| 167 | +// CHECK-NEXT: ret <8 x half> [[TMP4]] |
| 168 | +// |
| 169 | +float16x8_t test_vfmaq_m_n_f16(float16x8_t a, float16x8_t b, float16_t c, mve_pred16_t p) { |
| 170 | +#ifdef POLYMORPHIC |
| 171 | + return vfmaq_m(a, b, c, p); |
| 172 | +#else /* POLYMORPHIC */ |
| 173 | + return vfmaq_m_n_f16(a, b, c, p); |
| 174 | +#endif /* POLYMORPHIC */ |
| 175 | +} |
| 176 | + |
| 177 | +// CHECK-LABEL: @test_vfmaq_m_n_f32( |
| 178 | +// CHECK-NEXT: entry: |
| 179 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[C:%.*]], i32 0 |
| 180 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer |
| 181 | +// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32 |
| 182 | +// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]]) |
| 183 | +// CHECK-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.fma.predicated.v4f32.v4i1(<4 x float> [[B:%.*]], <4 x float> [[DOTSPLAT]], <4 x float> [[A:%.*]], <4 x i1> [[TMP1]]) |
| 184 | +// CHECK-NEXT: ret <4 x float> [[TMP2]] |
| 185 | +// |
| 186 | +float32x4_t test_vfmaq_m_n_f32(float32x4_t a, float32x4_t b, float32_t c, mve_pred16_t p) { |
| 187 | +#ifdef POLYMORPHIC |
| 188 | + return vfmaq_m(a, b, c, p); |
| 189 | +#else /* POLYMORPHIC */ |
| 190 | + return vfmaq_m_n_f32(a, b, c, p); |
| 191 | +#endif /* POLYMORPHIC */ |
| 192 | +} |
| 193 | + |
| 194 | +// CHECK-LABEL: @test_vfmasq_m_n_f16( |
| 195 | +// CHECK-NEXT: entry: |
| 196 | +// CHECK-NEXT: [[TMP0:%.*]] = bitcast float [[C_COERCE:%.*]] to i32 |
| 197 | +// CHECK-NEXT: [[TMP_0_EXTRACT_TRUNC:%.*]] = trunc i32 [[TMP0]] to i16 |
| 198 | +// CHECK-NEXT: [[TMP1:%.*]] = bitcast i16 [[TMP_0_EXTRACT_TRUNC]] to half |
| 199 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[TMP1]], i32 0 |
| 200 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <8 x half> [[DOTSPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer |
| 201 | +// CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[P:%.*]] to i32 |
| 202 | +// CHECK-NEXT: [[TMP3:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP2]]) |
| 203 | +// CHECK-NEXT: [[TMP4:%.*]] = call <8 x half> @llvm.arm.mve.fma.predicated.v8f16.v8i1(<8 x half> [[A:%.*]], <8 x half> [[B:%.*]], <8 x half> [[DOTSPLAT]], <8 x i1> [[TMP3]]) |
| 204 | +// CHECK-NEXT: ret <8 x half> [[TMP4]] |
| 205 | +// |
| 206 | +float16x8_t test_vfmasq_m_n_f16(float16x8_t a, float16x8_t b, float16_t c, mve_pred16_t p) { |
| 207 | +#ifdef POLYMORPHIC |
| 208 | + return vfmasq_m(a, b, c, p); |
| 209 | +#else /* POLYMORPHIC */ |
| 210 | + return vfmasq_m_n_f16(a, b, c, p); |
| 211 | +#endif /* POLYMORPHIC */ |
| 212 | +} |
| 213 | + |
| 214 | +// CHECK-LABEL: @test_vfmasq_m_n_f32( |
| 215 | +// CHECK-NEXT: entry: |
| 216 | +// CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[C:%.*]], i32 0 |
| 217 | +// CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer |
| 218 | +// CHECK-NEXT: [[TMP0:%.*]] = zext i16 [[P:%.*]] to i32 |
| 219 | +// CHECK-NEXT: [[TMP1:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP0]]) |
| 220 | +// CHECK-NEXT: [[TMP2:%.*]] = call <4 x float> @llvm.arm.mve.fma.predicated.v4f32.v4i1(<4 x float> [[A:%.*]], <4 x float> [[B:%.*]], <4 x float> [[DOTSPLAT]], <4 x i1> [[TMP1]]) |
| 221 | +// CHECK-NEXT: ret <4 x float> [[TMP2]] |
| 222 | +// |
| 223 | +float32x4_t test_vfmasq_m_n_f32(float32x4_t a, float32x4_t b, float32_t c, mve_pred16_t p) { |
| 224 | +#ifdef POLYMORPHIC |
| 225 | + return vfmasq_m(a, b, c, p); |
| 226 | +#else /* POLYMORPHIC */ |
| 227 | + return vfmasq_m_n_f32(a, b, c, p); |
| 228 | +#endif /* POLYMORPHIC */ |
| 229 | +} |
| 230 | + |
| 231 | +// CHECK-LABEL: @test_vfmsq_m_f16( |
| 232 | +// CHECK-NEXT: entry: |
| 233 | +// CHECK-NEXT: [[TMP0:%.*]] = fneg <8 x half> [[C:%.*]] |
| 234 | +// CHECK-NEXT: [[TMP1:%.*]] = zext i16 [[P:%.*]] to i32 |
| 235 | +// CHECK-NEXT: [[TMP2:%.*]] = call <8 x i1> @llvm.arm.mve.pred.i2v.v8i1(i32 [[TMP1]]) |
| 236 | +// CHECK-NEXT: [[TMP3:%.*]] = call <8 x half> @llvm.arm.mve.fma.predicated.v8f16.v8i1(<8 x half> [[B:%.*]], <8 x half> [[TMP0]], <8 x half> [[A:%.*]], <8 x i1> [[TMP2]]) |
| 237 | +// CHECK-NEXT: ret <8 x half> [[TMP3]] |
| 238 | +// |
| 239 | +float16x8_t test_vfmsq_m_f16(float16x8_t a, float16x8_t b, float16x8_t c, mve_pred16_t p) { |
| 240 | +#ifdef POLYMORPHIC |
| 241 | + return vfmsq_m(a, b, c, p); |
| 242 | +#else /* POLYMORPHIC */ |
| 243 | + return vfmsq_m_f16(a, b, c, p); |
| 244 | +#endif /* POLYMORPHIC */ |
| 245 | +} |
| 246 | + |
| 247 | +// CHECK-LABEL: @test_vfmsq_m_f32( |
| 248 | +// CHECK-NEXT: entry: |
| 249 | +// CHECK-NEXT: [[TMP0:%.*]] = fneg <4 x float> [[C:%.*]] |
| 250 | +// CHECK-NEXT: [[TMP1:%.*]] = zext i16 [[P:%.*]] to i32 |
| 251 | +// CHECK-NEXT: [[TMP2:%.*]] = call <4 x i1> @llvm.arm.mve.pred.i2v.v4i1(i32 [[TMP1]]) |
| 252 | +// CHECK-NEXT: [[TMP3:%.*]] = call <4 x float> @llvm.arm.mve.fma.predicated.v4f32.v4i1(<4 x float> [[B:%.*]], <4 x float> [[TMP0]], <4 x float> [[A:%.*]], <4 x i1> [[TMP2]]) |
| 253 | +// CHECK-NEXT: ret <4 x float> [[TMP3]] |
| 254 | +// |
| 255 | +float32x4_t test_vfmsq_m_f32(float32x4_t a, float32x4_t b, float32x4_t c, mve_pred16_t p) { |
| 256 | +#ifdef POLYMORPHIC |
| 257 | + return vfmsq_m(a, b, c, p); |
| 258 | +#else /* POLYMORPHIC */ |
| 259 | + return vfmsq_m_f32(a, b, c, p); |
| 260 | +#endif /* POLYMORPHIC */ |
| 261 | +} |
0 commit comments