1207e5cccSFangrui Song // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 2207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \ 3207e5cccSFangrui Song // RUN: -disable-O0-optnone -mvscale-min=4 -mvscale-max=4 \ 4207e5cccSFangrui Song // RUN: -emit-llvm -o - %s | opt -S -passes=sroa | FileCheck %s 5207e5cccSFangrui Song 6207e5cccSFangrui Song // REQUIRES: aarch64-registered-target 7207e5cccSFangrui Song 8207e5cccSFangrui Song #include <arm_sve.h> 9207e5cccSFangrui Song 10207e5cccSFangrui Song #define N 512 11207e5cccSFangrui Song 12207e5cccSFangrui Song typedef svint8_t fixed_int8_t __attribute__((arm_sve_vector_bits(N))); 13207e5cccSFangrui Song typedef svint16_t fixed_int16_t __attribute__((arm_sve_vector_bits(N))); 14207e5cccSFangrui Song typedef svint32_t fixed_int32_t __attribute__((arm_sve_vector_bits(N))); 15207e5cccSFangrui Song typedef svint64_t fixed_int64_t __attribute__((arm_sve_vector_bits(N))); 16207e5cccSFangrui Song 17207e5cccSFangrui Song typedef svuint8_t fixed_uint8_t __attribute__((arm_sve_vector_bits(N))); 18207e5cccSFangrui Song typedef svuint16_t fixed_uint16_t __attribute__((arm_sve_vector_bits(N))); 19207e5cccSFangrui Song typedef svuint32_t fixed_uint32_t __attribute__((arm_sve_vector_bits(N))); 20207e5cccSFangrui Song typedef svuint64_t fixed_uint64_t __attribute__((arm_sve_vector_bits(N))); 21207e5cccSFangrui Song 22207e5cccSFangrui Song typedef svfloat16_t fixed_float16_t __attribute__((arm_sve_vector_bits(N))); 23207e5cccSFangrui Song typedef svfloat32_t fixed_float32_t __attribute__((arm_sve_vector_bits(N))); 24207e5cccSFangrui Song typedef svfloat64_t fixed_float64_t __attribute__((arm_sve_vector_bits(N))); 25207e5cccSFangrui Song 26207e5cccSFangrui Song typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N))); 27207e5cccSFangrui Song 28207e5cccSFangrui Song // ADDITION 29207e5cccSFangrui Song 30207e5cccSFangrui Song // CHECK-LABEL: @add_i8( 31207e5cccSFangrui Song // CHECK-NEXT: entry: 32207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 33207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 34207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[B]] 35*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 36207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 37207e5cccSFangrui Song // 38207e5cccSFangrui Song fixed_int8_t add_i8(fixed_int8_t a, fixed_int8_t b) { 39207e5cccSFangrui Song return a + b; 40207e5cccSFangrui Song } 41207e5cccSFangrui Song 42207e5cccSFangrui Song // CHECK-LABEL: @add_i16( 43207e5cccSFangrui Song // CHECK-NEXT: entry: 44207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 45207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 46207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[B]] 47*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 48207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 49207e5cccSFangrui Song // 50207e5cccSFangrui Song fixed_int16_t add_i16(fixed_int16_t a, fixed_int16_t b) { 51207e5cccSFangrui Song return a + b; 52207e5cccSFangrui Song } 53207e5cccSFangrui Song 54207e5cccSFangrui Song // CHECK-LABEL: @add_i32( 55207e5cccSFangrui Song // CHECK-NEXT: entry: 56207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 57207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 58207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[B]] 59*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 60207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 61207e5cccSFangrui Song // 62207e5cccSFangrui Song fixed_int32_t add_i32(fixed_int32_t a, fixed_int32_t b) { 63207e5cccSFangrui Song return a + b; 64207e5cccSFangrui Song } 65207e5cccSFangrui Song 66207e5cccSFangrui Song // CHECK-LABEL: @add_i64( 67207e5cccSFangrui Song // CHECK-NEXT: entry: 68207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 69207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 70207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[B]] 71*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 72207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 73207e5cccSFangrui Song // 74207e5cccSFangrui Song fixed_int64_t add_i64(fixed_int64_t a, fixed_int64_t b) { 75207e5cccSFangrui Song return a + b; 76207e5cccSFangrui Song } 77207e5cccSFangrui Song 78207e5cccSFangrui Song // CHECK-LABEL: @add_u8( 79207e5cccSFangrui Song // CHECK-NEXT: entry: 80207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 81207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 82207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[B]] 83*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 84207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 85207e5cccSFangrui Song // 86207e5cccSFangrui Song fixed_uint8_t add_u8(fixed_uint8_t a, fixed_uint8_t b) { 87207e5cccSFangrui Song return a + b; 88207e5cccSFangrui Song } 89207e5cccSFangrui Song 90207e5cccSFangrui Song // CHECK-LABEL: @add_u16( 91207e5cccSFangrui Song // CHECK-NEXT: entry: 92207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 93207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 94207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[B]] 95*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 96207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 97207e5cccSFangrui Song // 98207e5cccSFangrui Song fixed_uint16_t add_u16(fixed_uint16_t a, fixed_uint16_t b) { 99207e5cccSFangrui Song return a + b; 100207e5cccSFangrui Song } 101207e5cccSFangrui Song 102207e5cccSFangrui Song // CHECK-LABEL: @add_u32( 103207e5cccSFangrui Song // CHECK-NEXT: entry: 104207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 105207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 106207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[B]] 107*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 108207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 109207e5cccSFangrui Song // 110207e5cccSFangrui Song fixed_uint32_t add_u32(fixed_uint32_t a, fixed_uint32_t b) { 111207e5cccSFangrui Song return a + b; 112207e5cccSFangrui Song } 113207e5cccSFangrui Song 114207e5cccSFangrui Song // CHECK-LABEL: @add_u64( 115207e5cccSFangrui Song // CHECK-NEXT: entry: 116207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 117207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 118207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[B]] 119*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 120207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 121207e5cccSFangrui Song // 122207e5cccSFangrui Song fixed_uint64_t add_u64(fixed_uint64_t a, fixed_uint64_t b) { 123207e5cccSFangrui Song return a + b; 124207e5cccSFangrui Song } 125207e5cccSFangrui Song 126207e5cccSFangrui Song // CHECK-LABEL: @add_f16( 127207e5cccSFangrui Song // CHECK-NEXT: entry: 128207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 129207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 130207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 131207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 132207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <32 x float> [[CONV]], [[CONV2]] 133207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[ADD]] to <32 x half> 134*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 135207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 136207e5cccSFangrui Song // 137207e5cccSFangrui Song fixed_float16_t add_f16(fixed_float16_t a, fixed_float16_t b) { 138207e5cccSFangrui Song return a + b; 139207e5cccSFangrui Song } 140207e5cccSFangrui Song 141207e5cccSFangrui Song // CHECK-LABEL: @add_f32( 142207e5cccSFangrui Song // CHECK-NEXT: entry: 143207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 144207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 145207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <16 x float> [[A]], [[B]] 146*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[ADD]], i64 0) 147207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 148207e5cccSFangrui Song // 149207e5cccSFangrui Song fixed_float32_t add_f32(fixed_float32_t a, fixed_float32_t b) { 150207e5cccSFangrui Song return a + b; 151207e5cccSFangrui Song } 152207e5cccSFangrui Song 153207e5cccSFangrui Song // CHECK-LABEL: @add_f64( 154207e5cccSFangrui Song // CHECK-NEXT: entry: 155207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 156207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 157207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <8 x double> [[A]], [[B]] 158*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[ADD]], i64 0) 159207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 160207e5cccSFangrui Song // 161207e5cccSFangrui Song fixed_float64_t add_f64(fixed_float64_t a, fixed_float64_t b) { 162207e5cccSFangrui Song return a + b; 163207e5cccSFangrui Song } 164207e5cccSFangrui Song 165207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i8( 166207e5cccSFangrui Song // CHECK-NEXT: entry: 167207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 168207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 169207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[B]] 170*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 171207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 172207e5cccSFangrui Song // 173207e5cccSFangrui Song fixed_int8_t add_inplace_i8(fixed_int8_t a, fixed_int8_t b) { 174207e5cccSFangrui Song return a += b; 175207e5cccSFangrui Song } 176207e5cccSFangrui Song 177207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i16( 178207e5cccSFangrui Song // CHECK-NEXT: entry: 179207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 180207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 181207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[B]] 182*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 183207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 184207e5cccSFangrui Song // 185207e5cccSFangrui Song fixed_int16_t add_inplace_i16(fixed_int16_t a, fixed_int16_t b) { 186207e5cccSFangrui Song return a += b; 187207e5cccSFangrui Song } 188207e5cccSFangrui Song 189207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i32( 190207e5cccSFangrui Song // CHECK-NEXT: entry: 191207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 192207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 193207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[B]] 194*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 195207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 196207e5cccSFangrui Song // 197207e5cccSFangrui Song fixed_int32_t add_inplace_i32(fixed_int32_t a, fixed_int32_t b) { 198207e5cccSFangrui Song return a += b; 199207e5cccSFangrui Song } 200207e5cccSFangrui Song 201207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_i64( 202207e5cccSFangrui Song // CHECK-NEXT: entry: 203207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 204207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 205207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[B]] 206*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 207207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 208207e5cccSFangrui Song // 209207e5cccSFangrui Song fixed_int64_t add_inplace_i64(fixed_int64_t a, fixed_int64_t b) { 210207e5cccSFangrui Song return a += b; 211207e5cccSFangrui Song } 212207e5cccSFangrui Song 213207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u8( 214207e5cccSFangrui Song // CHECK-NEXT: entry: 215207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 216207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 217207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[B]] 218*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 219207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 220207e5cccSFangrui Song // 221207e5cccSFangrui Song fixed_uint8_t add_inplace_u8(fixed_uint8_t a, fixed_uint8_t b) { 222207e5cccSFangrui Song return a += b; 223207e5cccSFangrui Song } 224207e5cccSFangrui Song 225207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u16( 226207e5cccSFangrui Song // CHECK-NEXT: entry: 227207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 228207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 229207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[B]] 230*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 231207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 232207e5cccSFangrui Song // 233207e5cccSFangrui Song fixed_uint16_t add_inplace_u16(fixed_uint16_t a, fixed_uint16_t b) { 234207e5cccSFangrui Song return a += b; 235207e5cccSFangrui Song } 236207e5cccSFangrui Song 237207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u32( 238207e5cccSFangrui Song // CHECK-NEXT: entry: 239207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 240207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 241207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[B]] 242*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 243207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 244207e5cccSFangrui Song // 245207e5cccSFangrui Song fixed_uint32_t add_inplace_u32(fixed_uint32_t a, fixed_uint32_t b) { 246207e5cccSFangrui Song return a += b; 247207e5cccSFangrui Song } 248207e5cccSFangrui Song 249207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_u64( 250207e5cccSFangrui Song // CHECK-NEXT: entry: 251207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 252207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 253207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[B]] 254*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 255207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 256207e5cccSFangrui Song // 257207e5cccSFangrui Song fixed_uint64_t add_inplace_u64(fixed_uint64_t a, fixed_uint64_t b) { 258207e5cccSFangrui Song return a += b; 259207e5cccSFangrui Song } 260207e5cccSFangrui Song 261207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f16( 262207e5cccSFangrui Song // CHECK-NEXT: entry: 263207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 264207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 265207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[B]] to <32 x float> 266207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[A]] to <32 x float> 267207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <32 x float> [[CONV2]], [[CONV]] 268207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[ADD]] to <32 x half> 269*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 270207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 271207e5cccSFangrui Song // 272207e5cccSFangrui Song fixed_float16_t add_inplace_f16(fixed_float16_t a, fixed_float16_t b) { 273207e5cccSFangrui Song return a += b; 274207e5cccSFangrui Song } 275207e5cccSFangrui Song 276207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f32( 277207e5cccSFangrui Song // CHECK-NEXT: entry: 278207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 279207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 280207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <16 x float> [[A]], [[B]] 281*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[ADD]], i64 0) 282207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 283207e5cccSFangrui Song // 284207e5cccSFangrui Song fixed_float32_t add_inplace_f32(fixed_float32_t a, fixed_float32_t b) { 285207e5cccSFangrui Song return a += b; 286207e5cccSFangrui Song } 287207e5cccSFangrui Song 288207e5cccSFangrui Song // CHECK-LABEL: @add_inplace_f64( 289207e5cccSFangrui Song // CHECK-NEXT: entry: 290207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 291207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 292207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <8 x double> [[A]], [[B]] 293*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[ADD]], i64 0) 294207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 295207e5cccSFangrui Song // 296207e5cccSFangrui Song fixed_float64_t add_inplace_f64(fixed_float64_t a, fixed_float64_t b) { 297207e5cccSFangrui Song return a += b; 298207e5cccSFangrui Song } 299207e5cccSFangrui Song 300207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i8( 301207e5cccSFangrui Song // CHECK-NEXT: entry: 302207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 303207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 304207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 305207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[SPLAT_SPLAT]] 306*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 307207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 308207e5cccSFangrui Song // 309207e5cccSFangrui Song fixed_int8_t add_scalar_i8(fixed_int8_t a, int8_t b) { 310207e5cccSFangrui Song return a + b; 311207e5cccSFangrui Song } 312207e5cccSFangrui Song 313207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i16( 314207e5cccSFangrui Song // CHECK-NEXT: entry: 315207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 316207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 317207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 318207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[SPLAT_SPLAT]] 319*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 320207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 321207e5cccSFangrui Song // 322207e5cccSFangrui Song fixed_int16_t add_scalar_i16(fixed_int16_t a, int16_t b) { 323207e5cccSFangrui Song return a + b; 324207e5cccSFangrui Song } 325207e5cccSFangrui Song 326207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i32( 327207e5cccSFangrui Song // CHECK-NEXT: entry: 328207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 329207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 330207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 331207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[SPLAT_SPLAT]] 332*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 333207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 334207e5cccSFangrui Song // 335207e5cccSFangrui Song fixed_int32_t add_scalar_i32(fixed_int32_t a, int32_t b) { 336207e5cccSFangrui Song return a + b; 337207e5cccSFangrui Song } 338207e5cccSFangrui Song 339207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_i64( 340207e5cccSFangrui Song // CHECK-NEXT: entry: 341207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 342207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 343207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 344207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[SPLAT_SPLAT]] 345*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 346207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 347207e5cccSFangrui Song // 348207e5cccSFangrui Song fixed_int64_t add_scalar_i64(fixed_int64_t a, int64_t b) { 349207e5cccSFangrui Song return a + b; 350207e5cccSFangrui Song } 351207e5cccSFangrui Song 352207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u8( 353207e5cccSFangrui Song // CHECK-NEXT: entry: 354207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 355207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 356207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 357207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <64 x i8> [[A]], [[SPLAT_SPLAT]] 358*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[ADD]], i64 0) 359207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 360207e5cccSFangrui Song // 361207e5cccSFangrui Song fixed_uint8_t add_scalar_u8(fixed_uint8_t a, uint8_t b) { 362207e5cccSFangrui Song return a + b; 363207e5cccSFangrui Song } 364207e5cccSFangrui Song 365207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u16( 366207e5cccSFangrui Song // CHECK-NEXT: entry: 367207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 368207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 369207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 370207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <32 x i16> [[A]], [[SPLAT_SPLAT]] 371*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[ADD]], i64 0) 372207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 373207e5cccSFangrui Song // 374207e5cccSFangrui Song fixed_uint16_t add_scalar_u16(fixed_uint16_t a, uint16_t b) { 375207e5cccSFangrui Song return a + b; 376207e5cccSFangrui Song } 377207e5cccSFangrui Song 378207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u32( 379207e5cccSFangrui Song // CHECK-NEXT: entry: 380207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 381207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 382207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 383207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <16 x i32> [[A]], [[SPLAT_SPLAT]] 384*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[ADD]], i64 0) 385207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 386207e5cccSFangrui Song // 387207e5cccSFangrui Song fixed_uint32_t add_scalar_u32(fixed_uint32_t a, uint32_t b) { 388207e5cccSFangrui Song return a + b; 389207e5cccSFangrui Song } 390207e5cccSFangrui Song 391207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_u64( 392207e5cccSFangrui Song // CHECK-NEXT: entry: 393207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 394207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 395207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 396207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = add <8 x i64> [[A]], [[SPLAT_SPLAT]] 397*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[ADD]], i64 0) 398207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 399207e5cccSFangrui Song // 400207e5cccSFangrui Song fixed_uint64_t add_scalar_u64(fixed_uint64_t a, uint64_t b) { 401207e5cccSFangrui Song return a + b; 402207e5cccSFangrui Song } 403207e5cccSFangrui Song 404207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f16( 405207e5cccSFangrui Song // CHECK-NEXT: entry: 406207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 407207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x half> poison, half [[B:%.*]], i64 0 408207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x half> [[SPLAT_SPLATINSERT]], <32 x half> poison, <32 x i32> zeroinitializer 409207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <32 x half> [[A]], [[SPLAT_SPLAT]] 410*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[ADD]], i64 0) 411207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 412207e5cccSFangrui Song // 413207e5cccSFangrui Song fixed_float16_t add_scalar_f16(fixed_float16_t a, __fp16 b) { 414207e5cccSFangrui Song return a + b; 415207e5cccSFangrui Song } 416207e5cccSFangrui Song 417207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f32( 418207e5cccSFangrui Song // CHECK-NEXT: entry: 419207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 420207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x float> poison, float [[B:%.*]], i64 0 421207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x float> [[SPLAT_SPLATINSERT]], <16 x float> poison, <16 x i32> zeroinitializer 422207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <16 x float> [[A]], [[SPLAT_SPLAT]] 423*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[ADD]], i64 0) 424207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 425207e5cccSFangrui Song // 426207e5cccSFangrui Song fixed_float32_t add_scalar_f32(fixed_float32_t a, float b) { 427207e5cccSFangrui Song return a + b; 428207e5cccSFangrui Song } 429207e5cccSFangrui Song 430207e5cccSFangrui Song // CHECK-LABEL: @add_scalar_f64( 431207e5cccSFangrui Song // CHECK-NEXT: entry: 432207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 433207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x double> poison, double [[B:%.*]], i64 0 434207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x double> [[SPLAT_SPLATINSERT]], <8 x double> poison, <8 x i32> zeroinitializer 435207e5cccSFangrui Song // CHECK-NEXT: [[ADD:%.*]] = fadd <8 x double> [[A]], [[SPLAT_SPLAT]] 436*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[ADD]], i64 0) 437207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 438207e5cccSFangrui Song // 439207e5cccSFangrui Song fixed_float64_t add_scalar_f64(fixed_float64_t a, double b) { 440207e5cccSFangrui Song return a + b; 441207e5cccSFangrui Song } 442207e5cccSFangrui Song 443207e5cccSFangrui Song // SUBTRACTION 444207e5cccSFangrui Song 445207e5cccSFangrui Song // CHECK-LABEL: @sub_i8( 446207e5cccSFangrui Song // CHECK-NEXT: entry: 447207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 448207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 449207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[B]] 450*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 451207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 452207e5cccSFangrui Song // 453207e5cccSFangrui Song fixed_int8_t sub_i8(fixed_int8_t a, fixed_int8_t b) { 454207e5cccSFangrui Song return a - b; 455207e5cccSFangrui Song } 456207e5cccSFangrui Song 457207e5cccSFangrui Song // CHECK-LABEL: @sub_i16( 458207e5cccSFangrui Song // CHECK-NEXT: entry: 459207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 460207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 461207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[B]] 462*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 463207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 464207e5cccSFangrui Song // 465207e5cccSFangrui Song fixed_int16_t sub_i16(fixed_int16_t a, fixed_int16_t b) { 466207e5cccSFangrui Song return a - b; 467207e5cccSFangrui Song } 468207e5cccSFangrui Song 469207e5cccSFangrui Song // CHECK-LABEL: @sub_i32( 470207e5cccSFangrui Song // CHECK-NEXT: entry: 471207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 472207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 473207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[B]] 474*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 475207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 476207e5cccSFangrui Song // 477207e5cccSFangrui Song fixed_int32_t sub_i32(fixed_int32_t a, fixed_int32_t b) { 478207e5cccSFangrui Song return a - b; 479207e5cccSFangrui Song } 480207e5cccSFangrui Song 481207e5cccSFangrui Song // CHECK-LABEL: @sub_i64( 482207e5cccSFangrui Song // CHECK-NEXT: entry: 483207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 484207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 485207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[B]] 486*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 487207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 488207e5cccSFangrui Song // 489207e5cccSFangrui Song fixed_int64_t sub_i64(fixed_int64_t a, fixed_int64_t b) { 490207e5cccSFangrui Song return a - b; 491207e5cccSFangrui Song } 492207e5cccSFangrui Song 493207e5cccSFangrui Song // CHECK-LABEL: @sub_u8( 494207e5cccSFangrui Song // CHECK-NEXT: entry: 495207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 496207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 497207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[B]] 498*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 499207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 500207e5cccSFangrui Song // 501207e5cccSFangrui Song fixed_uint8_t sub_u8(fixed_uint8_t a, fixed_uint8_t b) { 502207e5cccSFangrui Song return a - b; 503207e5cccSFangrui Song } 504207e5cccSFangrui Song 505207e5cccSFangrui Song // CHECK-LABEL: @sub_u16( 506207e5cccSFangrui Song // CHECK-NEXT: entry: 507207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 508207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 509207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[B]] 510*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 511207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 512207e5cccSFangrui Song // 513207e5cccSFangrui Song fixed_uint16_t sub_u16(fixed_uint16_t a, fixed_uint16_t b) { 514207e5cccSFangrui Song return a - b; 515207e5cccSFangrui Song } 516207e5cccSFangrui Song 517207e5cccSFangrui Song // CHECK-LABEL: @sub_u32( 518207e5cccSFangrui Song // CHECK-NEXT: entry: 519207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 520207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 521207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[B]] 522*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 523207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 524207e5cccSFangrui Song // 525207e5cccSFangrui Song fixed_uint32_t sub_u32(fixed_uint32_t a, fixed_uint32_t b) { 526207e5cccSFangrui Song return a - b; 527207e5cccSFangrui Song } 528207e5cccSFangrui Song 529207e5cccSFangrui Song // CHECK-LABEL: @sub_u64( 530207e5cccSFangrui Song // CHECK-NEXT: entry: 531207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 532207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 533207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[B]] 534*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 535207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 536207e5cccSFangrui Song // 537207e5cccSFangrui Song fixed_uint64_t sub_u64(fixed_uint64_t a, fixed_uint64_t b) { 538207e5cccSFangrui Song return a - b; 539207e5cccSFangrui Song } 540207e5cccSFangrui Song 541207e5cccSFangrui Song // CHECK-LABEL: @sub_f16( 542207e5cccSFangrui Song // CHECK-NEXT: entry: 543207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 544207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 545207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 546207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 547207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <32 x float> [[CONV]], [[CONV2]] 548207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[SUB]] to <32 x half> 549*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 550207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 551207e5cccSFangrui Song // 552207e5cccSFangrui Song fixed_float16_t sub_f16(fixed_float16_t a, fixed_float16_t b) { 553207e5cccSFangrui Song return a - b; 554207e5cccSFangrui Song } 555207e5cccSFangrui Song 556207e5cccSFangrui Song // CHECK-LABEL: @sub_f32( 557207e5cccSFangrui Song // CHECK-NEXT: entry: 558207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 559207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 560207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <16 x float> [[A]], [[B]] 561*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[SUB]], i64 0) 562207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 563207e5cccSFangrui Song // 564207e5cccSFangrui Song fixed_float32_t sub_f32(fixed_float32_t a, fixed_float32_t b) { 565207e5cccSFangrui Song return a - b; 566207e5cccSFangrui Song } 567207e5cccSFangrui Song 568207e5cccSFangrui Song // CHECK-LABEL: @sub_f64( 569207e5cccSFangrui Song // CHECK-NEXT: entry: 570207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 571207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 572207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <8 x double> [[A]], [[B]] 573*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[SUB]], i64 0) 574207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 575207e5cccSFangrui Song // 576207e5cccSFangrui Song fixed_float64_t sub_f64(fixed_float64_t a, fixed_float64_t b) { 577207e5cccSFangrui Song return a - b; 578207e5cccSFangrui Song } 579207e5cccSFangrui Song 580207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i8( 581207e5cccSFangrui Song // CHECK-NEXT: entry: 582207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 583207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 584207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[B]] 585*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 586207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 587207e5cccSFangrui Song // 588207e5cccSFangrui Song fixed_int8_t sub_inplace_i8(fixed_int8_t a, fixed_int8_t b) { 589207e5cccSFangrui Song return a - b; 590207e5cccSFangrui Song } 591207e5cccSFangrui Song 592207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i16( 593207e5cccSFangrui Song // CHECK-NEXT: entry: 594207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 595207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 596207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[B]] 597*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 598207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 599207e5cccSFangrui Song // 600207e5cccSFangrui Song fixed_int16_t sub_inplace_i16(fixed_int16_t a, fixed_int16_t b) { 601207e5cccSFangrui Song return a - b; 602207e5cccSFangrui Song } 603207e5cccSFangrui Song 604207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i32( 605207e5cccSFangrui Song // CHECK-NEXT: entry: 606207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 607207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 608207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[B]] 609*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 610207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 611207e5cccSFangrui Song // 612207e5cccSFangrui Song fixed_int32_t sub_inplace_i32(fixed_int32_t a, fixed_int32_t b) { 613207e5cccSFangrui Song return a - b; 614207e5cccSFangrui Song } 615207e5cccSFangrui Song 616207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_i64( 617207e5cccSFangrui Song // CHECK-NEXT: entry: 618207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 619207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 620207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[B]] 621*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 622207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 623207e5cccSFangrui Song // 624207e5cccSFangrui Song fixed_int64_t sub_inplace_i64(fixed_int64_t a, fixed_int64_t b) { 625207e5cccSFangrui Song return a - b; 626207e5cccSFangrui Song } 627207e5cccSFangrui Song 628207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u8( 629207e5cccSFangrui Song // CHECK-NEXT: entry: 630207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 631207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 632207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[B]] 633*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 634207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 635207e5cccSFangrui Song // 636207e5cccSFangrui Song fixed_uint8_t sub_inplace_u8(fixed_uint8_t a, fixed_uint8_t b) { 637207e5cccSFangrui Song return a - b; 638207e5cccSFangrui Song } 639207e5cccSFangrui Song 640207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u16( 641207e5cccSFangrui Song // CHECK-NEXT: entry: 642207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 643207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 644207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[B]] 645*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 646207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 647207e5cccSFangrui Song // 648207e5cccSFangrui Song fixed_uint16_t sub_inplace_u16(fixed_uint16_t a, fixed_uint16_t b) { 649207e5cccSFangrui Song return a - b; 650207e5cccSFangrui Song } 651207e5cccSFangrui Song 652207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u32( 653207e5cccSFangrui Song // CHECK-NEXT: entry: 654207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 655207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 656207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[B]] 657*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 658207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 659207e5cccSFangrui Song // 660207e5cccSFangrui Song fixed_uint32_t sub_inplace_u32(fixed_uint32_t a, fixed_uint32_t b) { 661207e5cccSFangrui Song return a - b; 662207e5cccSFangrui Song } 663207e5cccSFangrui Song 664207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_u64( 665207e5cccSFangrui Song // CHECK-NEXT: entry: 666207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 667207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 668207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[B]] 669*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 670207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 671207e5cccSFangrui Song // 672207e5cccSFangrui Song fixed_uint64_t sub_inplace_u64(fixed_uint64_t a, fixed_uint64_t b) { 673207e5cccSFangrui Song return a - b; 674207e5cccSFangrui Song } 675207e5cccSFangrui Song 676207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f16( 677207e5cccSFangrui Song // CHECK-NEXT: entry: 678207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 679207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 680207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 681207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 682207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <32 x float> [[CONV]], [[CONV2]] 683207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[SUB]] to <32 x half> 684*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 685207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 686207e5cccSFangrui Song // 687207e5cccSFangrui Song fixed_float16_t sub_inplace_f16(fixed_float16_t a, fixed_float16_t b) { 688207e5cccSFangrui Song return a - b; 689207e5cccSFangrui Song } 690207e5cccSFangrui Song 691207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f32( 692207e5cccSFangrui Song // CHECK-NEXT: entry: 693207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 694207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 695207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <16 x float> [[A]], [[B]] 696*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[SUB]], i64 0) 697207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 698207e5cccSFangrui Song // 699207e5cccSFangrui Song fixed_float32_t sub_inplace_f32(fixed_float32_t a, fixed_float32_t b) { 700207e5cccSFangrui Song return a - b; 701207e5cccSFangrui Song } 702207e5cccSFangrui Song 703207e5cccSFangrui Song // CHECK-LABEL: @sub_inplace_f64( 704207e5cccSFangrui Song // CHECK-NEXT: entry: 705207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 706207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 707207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <8 x double> [[A]], [[B]] 708*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[SUB]], i64 0) 709207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 710207e5cccSFangrui Song // 711207e5cccSFangrui Song fixed_float64_t sub_inplace_f64(fixed_float64_t a, fixed_float64_t b) { 712207e5cccSFangrui Song return a - b; 713207e5cccSFangrui Song } 714207e5cccSFangrui Song 715207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i8( 716207e5cccSFangrui Song // CHECK-NEXT: entry: 717207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 718207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 719207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 720207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[SPLAT_SPLAT]] 721*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 722207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 723207e5cccSFangrui Song // 724207e5cccSFangrui Song fixed_int8_t sub_scalar_i8(fixed_int8_t a, int8_t b) { 725207e5cccSFangrui Song return a - b; 726207e5cccSFangrui Song } 727207e5cccSFangrui Song 728207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i16( 729207e5cccSFangrui Song // CHECK-NEXT: entry: 730207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 731207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 732207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 733207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[SPLAT_SPLAT]] 734*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 735207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 736207e5cccSFangrui Song // 737207e5cccSFangrui Song fixed_int16_t sub_scalar_i16(fixed_int16_t a, int16_t b) { 738207e5cccSFangrui Song return a - b; 739207e5cccSFangrui Song } 740207e5cccSFangrui Song 741207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i32( 742207e5cccSFangrui Song // CHECK-NEXT: entry: 743207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 744207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 745207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 746207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[SPLAT_SPLAT]] 747*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 748207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 749207e5cccSFangrui Song // 750207e5cccSFangrui Song fixed_int32_t sub_scalar_i32(fixed_int32_t a, int32_t b) { 751207e5cccSFangrui Song return a - b; 752207e5cccSFangrui Song } 753207e5cccSFangrui Song 754207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_i64( 755207e5cccSFangrui Song // CHECK-NEXT: entry: 756207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 757207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 758207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 759207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[SPLAT_SPLAT]] 760*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 761207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 762207e5cccSFangrui Song // 763207e5cccSFangrui Song fixed_int64_t sub_scalar_i64(fixed_int64_t a, int64_t b) { 764207e5cccSFangrui Song return a - b; 765207e5cccSFangrui Song } 766207e5cccSFangrui Song 767207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u8( 768207e5cccSFangrui Song // CHECK-NEXT: entry: 769207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 770207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 771207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 772207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <64 x i8> [[A]], [[SPLAT_SPLAT]] 773*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[SUB]], i64 0) 774207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 775207e5cccSFangrui Song // 776207e5cccSFangrui Song fixed_uint8_t sub_scalar_u8(fixed_uint8_t a, uint8_t b) { 777207e5cccSFangrui Song return a - b; 778207e5cccSFangrui Song } 779207e5cccSFangrui Song 780207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u16( 781207e5cccSFangrui Song // CHECK-NEXT: entry: 782207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 783207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 784207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 785207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <32 x i16> [[A]], [[SPLAT_SPLAT]] 786*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[SUB]], i64 0) 787207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 788207e5cccSFangrui Song // 789207e5cccSFangrui Song fixed_uint16_t sub_scalar_u16(fixed_uint16_t a, uint16_t b) { 790207e5cccSFangrui Song return a - b; 791207e5cccSFangrui Song } 792207e5cccSFangrui Song 793207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u32( 794207e5cccSFangrui Song // CHECK-NEXT: entry: 795207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 796207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 797207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 798207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <16 x i32> [[A]], [[SPLAT_SPLAT]] 799*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[SUB]], i64 0) 800207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 801207e5cccSFangrui Song // 802207e5cccSFangrui Song fixed_uint32_t sub_scalar_u32(fixed_uint32_t a, uint32_t b) { 803207e5cccSFangrui Song return a - b; 804207e5cccSFangrui Song } 805207e5cccSFangrui Song 806207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_u64( 807207e5cccSFangrui Song // CHECK-NEXT: entry: 808207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 809207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 810207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 811207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = sub <8 x i64> [[A]], [[SPLAT_SPLAT]] 812*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[SUB]], i64 0) 813207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 814207e5cccSFangrui Song // 815207e5cccSFangrui Song fixed_uint64_t sub_scalar_u64(fixed_uint64_t a, uint64_t b) { 816207e5cccSFangrui Song return a - b; 817207e5cccSFangrui Song } 818207e5cccSFangrui Song 819207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f16( 820207e5cccSFangrui Song // CHECK-NEXT: entry: 821207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 822207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x half> poison, half [[B:%.*]], i64 0 823207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x half> [[SPLAT_SPLATINSERT]], <32 x half> poison, <32 x i32> zeroinitializer 824207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <32 x half> [[A]], [[SPLAT_SPLAT]] 825*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[SUB]], i64 0) 826207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 827207e5cccSFangrui Song // 828207e5cccSFangrui Song fixed_float16_t sub_scalar_f16(fixed_float16_t a, __fp16 b) { 829207e5cccSFangrui Song return a - b; 830207e5cccSFangrui Song } 831207e5cccSFangrui Song 832207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f32( 833207e5cccSFangrui Song // CHECK-NEXT: entry: 834207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 835207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x float> poison, float [[B:%.*]], i64 0 836207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x float> [[SPLAT_SPLATINSERT]], <16 x float> poison, <16 x i32> zeroinitializer 837207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <16 x float> [[A]], [[SPLAT_SPLAT]] 838*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[SUB]], i64 0) 839207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 840207e5cccSFangrui Song // 841207e5cccSFangrui Song fixed_float32_t sub_scalar_f32(fixed_float32_t a, float b) { 842207e5cccSFangrui Song return a - b; 843207e5cccSFangrui Song } 844207e5cccSFangrui Song 845207e5cccSFangrui Song // CHECK-LABEL: @sub_scalar_f64( 846207e5cccSFangrui Song // CHECK-NEXT: entry: 847207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 848207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x double> poison, double [[B:%.*]], i64 0 849207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x double> [[SPLAT_SPLATINSERT]], <8 x double> poison, <8 x i32> zeroinitializer 850207e5cccSFangrui Song // CHECK-NEXT: [[SUB:%.*]] = fsub <8 x double> [[A]], [[SPLAT_SPLAT]] 851*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[SUB]], i64 0) 852207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 853207e5cccSFangrui Song // 854207e5cccSFangrui Song fixed_float64_t sub_scalar_f64(fixed_float64_t a, double b) { 855207e5cccSFangrui Song return a - b; 856207e5cccSFangrui Song } 857207e5cccSFangrui Song 858207e5cccSFangrui Song // MULTIPLICATION 859207e5cccSFangrui Song 860207e5cccSFangrui Song // CHECK-LABEL: @mul_i8( 861207e5cccSFangrui Song // CHECK-NEXT: entry: 862207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 863207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 864207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[B]] 865*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 866207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 867207e5cccSFangrui Song // 868207e5cccSFangrui Song fixed_int8_t mul_i8(fixed_int8_t a, fixed_int8_t b) { 869207e5cccSFangrui Song return a * b; 870207e5cccSFangrui Song } 871207e5cccSFangrui Song 872207e5cccSFangrui Song // CHECK-LABEL: @mul_i16( 873207e5cccSFangrui Song // CHECK-NEXT: entry: 874207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 875207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 876207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[B]] 877*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 878207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 879207e5cccSFangrui Song // 880207e5cccSFangrui Song fixed_int16_t mul_i16(fixed_int16_t a, fixed_int16_t b) { 881207e5cccSFangrui Song return a * b; 882207e5cccSFangrui Song } 883207e5cccSFangrui Song 884207e5cccSFangrui Song // CHECK-LABEL: @mul_i32( 885207e5cccSFangrui Song // CHECK-NEXT: entry: 886207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 887207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 888207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[B]] 889*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 890207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 891207e5cccSFangrui Song // 892207e5cccSFangrui Song fixed_int32_t mul_i32(fixed_int32_t a, fixed_int32_t b) { 893207e5cccSFangrui Song return a * b; 894207e5cccSFangrui Song } 895207e5cccSFangrui Song 896207e5cccSFangrui Song // CHECK-LABEL: @mul_i64( 897207e5cccSFangrui Song // CHECK-NEXT: entry: 898207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 899207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 900207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[B]] 901*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 902207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 903207e5cccSFangrui Song // 904207e5cccSFangrui Song fixed_int64_t mul_i64(fixed_int64_t a, fixed_int64_t b) { 905207e5cccSFangrui Song return a * b; 906207e5cccSFangrui Song } 907207e5cccSFangrui Song 908207e5cccSFangrui Song // CHECK-LABEL: @mul_u8( 909207e5cccSFangrui Song // CHECK-NEXT: entry: 910207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 911207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 912207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[B]] 913*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 914207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 915207e5cccSFangrui Song // 916207e5cccSFangrui Song fixed_uint8_t mul_u8(fixed_uint8_t a, fixed_uint8_t b) { 917207e5cccSFangrui Song return a * b; 918207e5cccSFangrui Song } 919207e5cccSFangrui Song 920207e5cccSFangrui Song // CHECK-LABEL: @mul_u16( 921207e5cccSFangrui Song // CHECK-NEXT: entry: 922207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 923207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 924207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[B]] 925*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 926207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 927207e5cccSFangrui Song // 928207e5cccSFangrui Song fixed_uint16_t mul_u16(fixed_uint16_t a, fixed_uint16_t b) { 929207e5cccSFangrui Song return a * b; 930207e5cccSFangrui Song } 931207e5cccSFangrui Song 932207e5cccSFangrui Song // CHECK-LABEL: @mul_u32( 933207e5cccSFangrui Song // CHECK-NEXT: entry: 934207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 935207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 936207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[B]] 937*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 938207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 939207e5cccSFangrui Song // 940207e5cccSFangrui Song fixed_uint32_t mul_u32(fixed_uint32_t a, fixed_uint32_t b) { 941207e5cccSFangrui Song return a * b; 942207e5cccSFangrui Song } 943207e5cccSFangrui Song 944207e5cccSFangrui Song // CHECK-LABEL: @mul_u64( 945207e5cccSFangrui Song // CHECK-NEXT: entry: 946207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 947207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 948207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[B]] 949*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 950207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 951207e5cccSFangrui Song // 952207e5cccSFangrui Song fixed_uint64_t mul_u64(fixed_uint64_t a, fixed_uint64_t b) { 953207e5cccSFangrui Song return a * b; 954207e5cccSFangrui Song } 955207e5cccSFangrui Song 956207e5cccSFangrui Song // CHECK-LABEL: @mul_f16( 957207e5cccSFangrui Song // CHECK-NEXT: entry: 958207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 959207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 960207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 961207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 962207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <32 x float> [[CONV]], [[CONV2]] 963207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[MUL]] to <32 x half> 964*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 965207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 966207e5cccSFangrui Song // 967207e5cccSFangrui Song fixed_float16_t mul_f16(fixed_float16_t a, fixed_float16_t b) { 968207e5cccSFangrui Song return a * b; 969207e5cccSFangrui Song } 970207e5cccSFangrui Song 971207e5cccSFangrui Song // CHECK-LABEL: @mul_f32( 972207e5cccSFangrui Song // CHECK-NEXT: entry: 973207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 974207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 975207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <16 x float> [[A]], [[B]] 976*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[MUL]], i64 0) 977207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 978207e5cccSFangrui Song // 979207e5cccSFangrui Song fixed_float32_t mul_f32(fixed_float32_t a, fixed_float32_t b) { 980207e5cccSFangrui Song return a * b; 981207e5cccSFangrui Song } 982207e5cccSFangrui Song 983207e5cccSFangrui Song // CHECK-LABEL: @mul_f64( 984207e5cccSFangrui Song // CHECK-NEXT: entry: 985207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 986207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 987207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <8 x double> [[A]], [[B]] 988*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[MUL]], i64 0) 989207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 990207e5cccSFangrui Song // 991207e5cccSFangrui Song fixed_float64_t mul_f64(fixed_float64_t a, fixed_float64_t b) { 992207e5cccSFangrui Song return a * b; 993207e5cccSFangrui Song } 994207e5cccSFangrui Song 995207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i8( 996207e5cccSFangrui Song // CHECK-NEXT: entry: 997207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 998207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 999207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[B]] 1000*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 1001207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1002207e5cccSFangrui Song // 1003207e5cccSFangrui Song fixed_int8_t mul_inplace_i8(fixed_int8_t a, fixed_int8_t b) { 1004207e5cccSFangrui Song return a * b; 1005207e5cccSFangrui Song } 1006207e5cccSFangrui Song 1007207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i16( 1008207e5cccSFangrui Song // CHECK-NEXT: entry: 1009207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1010207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1011207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[B]] 1012*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 1013207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1014207e5cccSFangrui Song // 1015207e5cccSFangrui Song fixed_int16_t mul_inplace_i16(fixed_int16_t a, fixed_int16_t b) { 1016207e5cccSFangrui Song return a * b; 1017207e5cccSFangrui Song } 1018207e5cccSFangrui Song 1019207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i32( 1020207e5cccSFangrui Song // CHECK-NEXT: entry: 1021207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1022207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1023207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[B]] 1024*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 1025207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1026207e5cccSFangrui Song // 1027207e5cccSFangrui Song fixed_int32_t mul_inplace_i32(fixed_int32_t a, fixed_int32_t b) { 1028207e5cccSFangrui Song return a * b; 1029207e5cccSFangrui Song } 1030207e5cccSFangrui Song 1031207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_i64( 1032207e5cccSFangrui Song // CHECK-NEXT: entry: 1033207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1034207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1035207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[B]] 1036*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 1037207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1038207e5cccSFangrui Song // 1039207e5cccSFangrui Song fixed_int64_t mul_inplace_i64(fixed_int64_t a, fixed_int64_t b) { 1040207e5cccSFangrui Song return a * b; 1041207e5cccSFangrui Song } 1042207e5cccSFangrui Song 1043207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u8( 1044207e5cccSFangrui Song // CHECK-NEXT: entry: 1045207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1046207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1047207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[B]] 1048*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 1049207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1050207e5cccSFangrui Song // 1051207e5cccSFangrui Song fixed_uint8_t mul_inplace_u8(fixed_uint8_t a, fixed_uint8_t b) { 1052207e5cccSFangrui Song return a * b; 1053207e5cccSFangrui Song } 1054207e5cccSFangrui Song 1055207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u16( 1056207e5cccSFangrui Song // CHECK-NEXT: entry: 1057207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1058207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1059207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[B]] 1060*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 1061207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1062207e5cccSFangrui Song // 1063207e5cccSFangrui Song fixed_uint16_t mul_inplace_u16(fixed_uint16_t a, fixed_uint16_t b) { 1064207e5cccSFangrui Song return a * b; 1065207e5cccSFangrui Song } 1066207e5cccSFangrui Song 1067207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u32( 1068207e5cccSFangrui Song // CHECK-NEXT: entry: 1069207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1070207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1071207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[B]] 1072*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 1073207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1074207e5cccSFangrui Song // 1075207e5cccSFangrui Song fixed_uint32_t mul_inplace_u32(fixed_uint32_t a, fixed_uint32_t b) { 1076207e5cccSFangrui Song return a * b; 1077207e5cccSFangrui Song } 1078207e5cccSFangrui Song 1079207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_u64( 1080207e5cccSFangrui Song // CHECK-NEXT: entry: 1081207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1082207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1083207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[B]] 1084*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 1085207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1086207e5cccSFangrui Song // 1087207e5cccSFangrui Song fixed_uint64_t mul_inplace_u64(fixed_uint64_t a, fixed_uint64_t b) { 1088207e5cccSFangrui Song return a * b; 1089207e5cccSFangrui Song } 1090207e5cccSFangrui Song 1091207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f16( 1092207e5cccSFangrui Song // CHECK-NEXT: entry: 1093207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 1094207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 1095207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 1096207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 1097207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <32 x float> [[CONV]], [[CONV2]] 1098207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[MUL]] to <32 x half> 1099*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 1100207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 1101207e5cccSFangrui Song // 1102207e5cccSFangrui Song fixed_float16_t mul_inplace_f16(fixed_float16_t a, fixed_float16_t b) { 1103207e5cccSFangrui Song return a * b; 1104207e5cccSFangrui Song } 1105207e5cccSFangrui Song 1106207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f32( 1107207e5cccSFangrui Song // CHECK-NEXT: entry: 1108207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 1109207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 1110207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <16 x float> [[A]], [[B]] 1111*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[MUL]], i64 0) 1112207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 1113207e5cccSFangrui Song // 1114207e5cccSFangrui Song fixed_float32_t mul_inplace_f32(fixed_float32_t a, fixed_float32_t b) { 1115207e5cccSFangrui Song return a * b; 1116207e5cccSFangrui Song } 1117207e5cccSFangrui Song 1118207e5cccSFangrui Song // CHECK-LABEL: @mul_inplace_f64( 1119207e5cccSFangrui Song // CHECK-NEXT: entry: 1120207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 1121207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 1122207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <8 x double> [[A]], [[B]] 1123*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[MUL]], i64 0) 1124207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 1125207e5cccSFangrui Song // 1126207e5cccSFangrui Song fixed_float64_t mul_inplace_f64(fixed_float64_t a, fixed_float64_t b) { 1127207e5cccSFangrui Song return a * b; 1128207e5cccSFangrui Song } 1129207e5cccSFangrui Song 1130207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i8( 1131207e5cccSFangrui Song // CHECK-NEXT: entry: 1132207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1133207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1134207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1135207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[SPLAT_SPLAT]] 1136*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 1137207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1138207e5cccSFangrui Song // 1139207e5cccSFangrui Song fixed_int8_t mul_scalar_i8(fixed_int8_t a, int8_t b) { 1140207e5cccSFangrui Song return a * b; 1141207e5cccSFangrui Song } 1142207e5cccSFangrui Song 1143207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i16( 1144207e5cccSFangrui Song // CHECK-NEXT: entry: 1145207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1146207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1147207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1148207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[SPLAT_SPLAT]] 1149*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 1150207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1151207e5cccSFangrui Song // 1152207e5cccSFangrui Song fixed_int16_t mul_scalar_i16(fixed_int16_t a, int16_t b) { 1153207e5cccSFangrui Song return a * b; 1154207e5cccSFangrui Song } 1155207e5cccSFangrui Song 1156207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i32( 1157207e5cccSFangrui Song // CHECK-NEXT: entry: 1158207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1159207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1160207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1161207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[SPLAT_SPLAT]] 1162*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 1163207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1164207e5cccSFangrui Song // 1165207e5cccSFangrui Song fixed_int32_t mul_scalar_i32(fixed_int32_t a, int32_t b) { 1166207e5cccSFangrui Song return a * b; 1167207e5cccSFangrui Song } 1168207e5cccSFangrui Song 1169207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_i64( 1170207e5cccSFangrui Song // CHECK-NEXT: entry: 1171207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1172207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1173207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1174207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[SPLAT_SPLAT]] 1175*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 1176207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1177207e5cccSFangrui Song // 1178207e5cccSFangrui Song fixed_int64_t mul_scalar_i64(fixed_int64_t a, int64_t b) { 1179207e5cccSFangrui Song return a * b; 1180207e5cccSFangrui Song } 1181207e5cccSFangrui Song 1182207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u8( 1183207e5cccSFangrui Song // CHECK-NEXT: entry: 1184207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1185207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1186207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1187207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <64 x i8> [[A]], [[SPLAT_SPLAT]] 1188*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[MUL]], i64 0) 1189207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1190207e5cccSFangrui Song // 1191207e5cccSFangrui Song fixed_uint8_t mul_scalar_u8(fixed_uint8_t a, uint8_t b) { 1192207e5cccSFangrui Song return a * b; 1193207e5cccSFangrui Song } 1194207e5cccSFangrui Song 1195207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u16( 1196207e5cccSFangrui Song // CHECK-NEXT: entry: 1197207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1198207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1199207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1200207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <32 x i16> [[A]], [[SPLAT_SPLAT]] 1201*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[MUL]], i64 0) 1202207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1203207e5cccSFangrui Song // 1204207e5cccSFangrui Song fixed_uint16_t mul_scalar_u16(fixed_uint16_t a, uint16_t b) { 1205207e5cccSFangrui Song return a * b; 1206207e5cccSFangrui Song } 1207207e5cccSFangrui Song 1208207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u32( 1209207e5cccSFangrui Song // CHECK-NEXT: entry: 1210207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1211207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1212207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1213207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <16 x i32> [[A]], [[SPLAT_SPLAT]] 1214*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[MUL]], i64 0) 1215207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1216207e5cccSFangrui Song // 1217207e5cccSFangrui Song fixed_uint32_t mul_scalar_u32(fixed_uint32_t a, uint32_t b) { 1218207e5cccSFangrui Song return a * b; 1219207e5cccSFangrui Song } 1220207e5cccSFangrui Song 1221207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_u64( 1222207e5cccSFangrui Song // CHECK-NEXT: entry: 1223207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1224207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1225207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1226207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = mul <8 x i64> [[A]], [[SPLAT_SPLAT]] 1227*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[MUL]], i64 0) 1228207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1229207e5cccSFangrui Song // 1230207e5cccSFangrui Song fixed_uint64_t mul_scalar_u64(fixed_uint64_t a, uint64_t b) { 1231207e5cccSFangrui Song return a * b; 1232207e5cccSFangrui Song } 1233207e5cccSFangrui Song 1234207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f16( 1235207e5cccSFangrui Song // CHECK-NEXT: entry: 1236207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 1237207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x half> poison, half [[B:%.*]], i64 0 1238207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x half> [[SPLAT_SPLATINSERT]], <32 x half> poison, <32 x i32> zeroinitializer 1239207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <32 x half> [[A]], [[SPLAT_SPLAT]] 1240*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[MUL]], i64 0) 1241207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 1242207e5cccSFangrui Song // 1243207e5cccSFangrui Song fixed_float16_t mul_scalar_f16(fixed_float16_t a, __fp16 b) { 1244207e5cccSFangrui Song return a * b; 1245207e5cccSFangrui Song } 1246207e5cccSFangrui Song 1247207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f32( 1248207e5cccSFangrui Song // CHECK-NEXT: entry: 1249207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 1250207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x float> poison, float [[B:%.*]], i64 0 1251207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x float> [[SPLAT_SPLATINSERT]], <16 x float> poison, <16 x i32> zeroinitializer 1252207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <16 x float> [[A]], [[SPLAT_SPLAT]] 1253*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[MUL]], i64 0) 1254207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 1255207e5cccSFangrui Song // 1256207e5cccSFangrui Song fixed_float32_t mul_scalar_f32(fixed_float32_t a, float b) { 1257207e5cccSFangrui Song return a * b; 1258207e5cccSFangrui Song } 1259207e5cccSFangrui Song 1260207e5cccSFangrui Song // CHECK-LABEL: @mul_scalar_f64( 1261207e5cccSFangrui Song // CHECK-NEXT: entry: 1262207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 1263207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x double> poison, double [[B:%.*]], i64 0 1264207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x double> [[SPLAT_SPLATINSERT]], <8 x double> poison, <8 x i32> zeroinitializer 1265207e5cccSFangrui Song // CHECK-NEXT: [[MUL:%.*]] = fmul <8 x double> [[A]], [[SPLAT_SPLAT]] 1266*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[MUL]], i64 0) 1267207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 1268207e5cccSFangrui Song // 1269207e5cccSFangrui Song fixed_float64_t mul_scalar_f64(fixed_float64_t a, double b) { 1270207e5cccSFangrui Song return a * b; 1271207e5cccSFangrui Song } 1272207e5cccSFangrui Song 1273207e5cccSFangrui Song // DIVISION 1274207e5cccSFangrui Song 1275207e5cccSFangrui Song // CHECK-LABEL: @div_i8( 1276207e5cccSFangrui Song // CHECK-NEXT: entry: 1277207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1278207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1279207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <64 x i8> [[A]], [[B]] 1280*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1281207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1282207e5cccSFangrui Song // 1283207e5cccSFangrui Song fixed_int8_t div_i8(fixed_int8_t a, fixed_int8_t b) { 1284207e5cccSFangrui Song return a / b; 1285207e5cccSFangrui Song } 1286207e5cccSFangrui Song 1287207e5cccSFangrui Song // CHECK-LABEL: @div_i16( 1288207e5cccSFangrui Song // CHECK-NEXT: entry: 1289207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1290207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1291207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <32 x i16> [[A]], [[B]] 1292*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1293207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1294207e5cccSFangrui Song // 1295207e5cccSFangrui Song fixed_int16_t div_i16(fixed_int16_t a, fixed_int16_t b) { 1296207e5cccSFangrui Song return a / b; 1297207e5cccSFangrui Song } 1298207e5cccSFangrui Song 1299207e5cccSFangrui Song // CHECK-LABEL: @div_i32( 1300207e5cccSFangrui Song // CHECK-NEXT: entry: 1301207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1302207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1303207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <16 x i32> [[A]], [[B]] 1304*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1305207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1306207e5cccSFangrui Song // 1307207e5cccSFangrui Song fixed_int32_t div_i32(fixed_int32_t a, fixed_int32_t b) { 1308207e5cccSFangrui Song return a / b; 1309207e5cccSFangrui Song } 1310207e5cccSFangrui Song 1311207e5cccSFangrui Song // CHECK-LABEL: @div_i64( 1312207e5cccSFangrui Song // CHECK-NEXT: entry: 1313207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1314207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1315207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <8 x i64> [[A]], [[B]] 1316*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1317207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1318207e5cccSFangrui Song // 1319207e5cccSFangrui Song fixed_int64_t div_i64(fixed_int64_t a, fixed_int64_t b) { 1320207e5cccSFangrui Song return a / b; 1321207e5cccSFangrui Song } 1322207e5cccSFangrui Song 1323207e5cccSFangrui Song // CHECK-LABEL: @div_u8( 1324207e5cccSFangrui Song // CHECK-NEXT: entry: 1325207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1326207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1327207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <64 x i8> [[A]], [[B]] 1328*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1329207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1330207e5cccSFangrui Song // 1331207e5cccSFangrui Song fixed_uint8_t div_u8(fixed_uint8_t a, fixed_uint8_t b) { 1332207e5cccSFangrui Song return a / b; 1333207e5cccSFangrui Song } 1334207e5cccSFangrui Song 1335207e5cccSFangrui Song // CHECK-LABEL: @div_u16( 1336207e5cccSFangrui Song // CHECK-NEXT: entry: 1337207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1338207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1339207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <32 x i16> [[A]], [[B]] 1340*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1341207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1342207e5cccSFangrui Song // 1343207e5cccSFangrui Song fixed_uint16_t div_u16(fixed_uint16_t a, fixed_uint16_t b) { 1344207e5cccSFangrui Song return a / b; 1345207e5cccSFangrui Song } 1346207e5cccSFangrui Song 1347207e5cccSFangrui Song // CHECK-LABEL: @div_u32( 1348207e5cccSFangrui Song // CHECK-NEXT: entry: 1349207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1350207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1351207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <16 x i32> [[A]], [[B]] 1352*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1353207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1354207e5cccSFangrui Song // 1355207e5cccSFangrui Song fixed_uint32_t div_u32(fixed_uint32_t a, fixed_uint32_t b) { 1356207e5cccSFangrui Song return a / b; 1357207e5cccSFangrui Song } 1358207e5cccSFangrui Song 1359207e5cccSFangrui Song // CHECK-LABEL: @div_u64( 1360207e5cccSFangrui Song // CHECK-NEXT: entry: 1361207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1362207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1363207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <8 x i64> [[A]], [[B]] 1364*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1365207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1366207e5cccSFangrui Song // 1367207e5cccSFangrui Song fixed_uint64_t div_u64(fixed_uint64_t a, fixed_uint64_t b) { 1368207e5cccSFangrui Song return a / b; 1369207e5cccSFangrui Song } 1370207e5cccSFangrui Song 1371207e5cccSFangrui Song // CHECK-LABEL: @div_f16( 1372207e5cccSFangrui Song // CHECK-NEXT: entry: 1373207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 1374207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 1375207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 1376207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 1377207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <32 x float> [[CONV]], [[CONV2]] 1378207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[DIV]] to <32 x half> 1379*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 1380207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 1381207e5cccSFangrui Song // 1382207e5cccSFangrui Song fixed_float16_t div_f16(fixed_float16_t a, fixed_float16_t b) { 1383207e5cccSFangrui Song return a / b; 1384207e5cccSFangrui Song } 1385207e5cccSFangrui Song 1386207e5cccSFangrui Song // CHECK-LABEL: @div_f32( 1387207e5cccSFangrui Song // CHECK-NEXT: entry: 1388207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 1389207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 1390207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <16 x float> [[A]], [[B]] 1391*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[DIV]], i64 0) 1392207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 1393207e5cccSFangrui Song // 1394207e5cccSFangrui Song fixed_float32_t div_f32(fixed_float32_t a, fixed_float32_t b) { 1395207e5cccSFangrui Song return a / b; 1396207e5cccSFangrui Song } 1397207e5cccSFangrui Song 1398207e5cccSFangrui Song // CHECK-LABEL: @div_f64( 1399207e5cccSFangrui Song // CHECK-NEXT: entry: 1400207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 1401207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 1402207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <8 x double> [[A]], [[B]] 1403*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[DIV]], i64 0) 1404207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 1405207e5cccSFangrui Song // 1406207e5cccSFangrui Song fixed_float64_t div_f64(fixed_float64_t a, fixed_float64_t b) { 1407207e5cccSFangrui Song return a / b; 1408207e5cccSFangrui Song } 1409207e5cccSFangrui Song 1410207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i8( 1411207e5cccSFangrui Song // CHECK-NEXT: entry: 1412207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1413207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1414207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <64 x i8> [[A]], [[B]] 1415*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1416207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1417207e5cccSFangrui Song // 1418207e5cccSFangrui Song fixed_int8_t div_inplace_i8(fixed_int8_t a, fixed_int8_t b) { 1419207e5cccSFangrui Song return a / b; 1420207e5cccSFangrui Song } 1421207e5cccSFangrui Song 1422207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i16( 1423207e5cccSFangrui Song // CHECK-NEXT: entry: 1424207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1425207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1426207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <32 x i16> [[A]], [[B]] 1427*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1428207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1429207e5cccSFangrui Song // 1430207e5cccSFangrui Song fixed_int16_t div_inplace_i16(fixed_int16_t a, fixed_int16_t b) { 1431207e5cccSFangrui Song return a / b; 1432207e5cccSFangrui Song } 1433207e5cccSFangrui Song 1434207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i32( 1435207e5cccSFangrui Song // CHECK-NEXT: entry: 1436207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1437207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1438207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <16 x i32> [[A]], [[B]] 1439*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1440207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1441207e5cccSFangrui Song // 1442207e5cccSFangrui Song fixed_int32_t div_inplace_i32(fixed_int32_t a, fixed_int32_t b) { 1443207e5cccSFangrui Song return a / b; 1444207e5cccSFangrui Song } 1445207e5cccSFangrui Song 1446207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_i64( 1447207e5cccSFangrui Song // CHECK-NEXT: entry: 1448207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1449207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1450207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <8 x i64> [[A]], [[B]] 1451*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1452207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1453207e5cccSFangrui Song // 1454207e5cccSFangrui Song fixed_int64_t div_inplace_i64(fixed_int64_t a, fixed_int64_t b) { 1455207e5cccSFangrui Song return a / b; 1456207e5cccSFangrui Song } 1457207e5cccSFangrui Song 1458207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u8( 1459207e5cccSFangrui Song // CHECK-NEXT: entry: 1460207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1461207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1462207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <64 x i8> [[A]], [[B]] 1463*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1464207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1465207e5cccSFangrui Song // 1466207e5cccSFangrui Song fixed_uint8_t div_inplace_u8(fixed_uint8_t a, fixed_uint8_t b) { 1467207e5cccSFangrui Song return a / b; 1468207e5cccSFangrui Song } 1469207e5cccSFangrui Song 1470207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u16( 1471207e5cccSFangrui Song // CHECK-NEXT: entry: 1472207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1473207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1474207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <32 x i16> [[A]], [[B]] 1475*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1476207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1477207e5cccSFangrui Song // 1478207e5cccSFangrui Song fixed_uint16_t div_inplace_u16(fixed_uint16_t a, fixed_uint16_t b) { 1479207e5cccSFangrui Song return a / b; 1480207e5cccSFangrui Song } 1481207e5cccSFangrui Song 1482207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u32( 1483207e5cccSFangrui Song // CHECK-NEXT: entry: 1484207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1485207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1486207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <16 x i32> [[A]], [[B]] 1487*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1488207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1489207e5cccSFangrui Song // 1490207e5cccSFangrui Song fixed_uint32_t div_inplace_u32(fixed_uint32_t a, fixed_uint32_t b) { 1491207e5cccSFangrui Song return a / b; 1492207e5cccSFangrui Song } 1493207e5cccSFangrui Song 1494207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_u64( 1495207e5cccSFangrui Song // CHECK-NEXT: entry: 1496207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1497207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1498207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <8 x i64> [[A]], [[B]] 1499*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1500207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1501207e5cccSFangrui Song // 1502207e5cccSFangrui Song fixed_uint64_t div_inplace_u64(fixed_uint64_t a, fixed_uint64_t b) { 1503207e5cccSFangrui Song return a / b; 1504207e5cccSFangrui Song } 1505207e5cccSFangrui Song 1506207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f16( 1507207e5cccSFangrui Song // CHECK-NEXT: entry: 1508207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 1509207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[B_COERCE:%.*]], i64 0) 1510207e5cccSFangrui Song // CHECK-NEXT: [[CONV:%.*]] = fpext <32 x half> [[A]] to <32 x float> 1511207e5cccSFangrui Song // CHECK-NEXT: [[CONV2:%.*]] = fpext <32 x half> [[B]] to <32 x float> 1512207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <32 x float> [[CONV]], [[CONV2]] 1513207e5cccSFangrui Song // CHECK-NEXT: [[CONV3:%.*]] = fptrunc <32 x float> [[DIV]] to <32 x half> 1514*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[CONV3]], i64 0) 1515207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 1516207e5cccSFangrui Song // 1517207e5cccSFangrui Song fixed_float16_t div_inplace_f16(fixed_float16_t a, fixed_float16_t b) { 1518207e5cccSFangrui Song return a / b; 1519207e5cccSFangrui Song } 1520207e5cccSFangrui Song 1521207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f32( 1522207e5cccSFangrui Song // CHECK-NEXT: entry: 1523207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 1524207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[B_COERCE:%.*]], i64 0) 1525207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <16 x float> [[A]], [[B]] 1526*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[DIV]], i64 0) 1527207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 1528207e5cccSFangrui Song // 1529207e5cccSFangrui Song fixed_float32_t div_inplace_f32(fixed_float32_t a, fixed_float32_t b) { 1530207e5cccSFangrui Song return a / b; 1531207e5cccSFangrui Song } 1532207e5cccSFangrui Song 1533207e5cccSFangrui Song // CHECK-LABEL: @div_inplace_f64( 1534207e5cccSFangrui Song // CHECK-NEXT: entry: 1535207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 1536207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[B_COERCE:%.*]], i64 0) 1537207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <8 x double> [[A]], [[B]] 1538*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[DIV]], i64 0) 1539207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 1540207e5cccSFangrui Song // 1541207e5cccSFangrui Song fixed_float64_t div_inplace_f64(fixed_float64_t a, fixed_float64_t b) { 1542207e5cccSFangrui Song return a / b; 1543207e5cccSFangrui Song } 1544207e5cccSFangrui Song 1545207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i8( 1546207e5cccSFangrui Song // CHECK-NEXT: entry: 1547207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1548207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1549207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1550207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <64 x i8> [[A]], [[SPLAT_SPLAT]] 1551*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1552207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1553207e5cccSFangrui Song // 1554207e5cccSFangrui Song fixed_int8_t div_scalar_i8(fixed_int8_t a, int8_t b) { 1555207e5cccSFangrui Song return a / b; 1556207e5cccSFangrui Song } 1557207e5cccSFangrui Song 1558207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i16( 1559207e5cccSFangrui Song // CHECK-NEXT: entry: 1560207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1561207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1562207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1563207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <32 x i16> [[A]], [[SPLAT_SPLAT]] 1564*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1565207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1566207e5cccSFangrui Song // 1567207e5cccSFangrui Song fixed_int16_t div_scalar_i16(fixed_int16_t a, int16_t b) { 1568207e5cccSFangrui Song return a / b; 1569207e5cccSFangrui Song } 1570207e5cccSFangrui Song 1571207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i32( 1572207e5cccSFangrui Song // CHECK-NEXT: entry: 1573207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1574207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1575207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1576207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <16 x i32> [[A]], [[SPLAT_SPLAT]] 1577*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1578207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1579207e5cccSFangrui Song // 1580207e5cccSFangrui Song fixed_int32_t div_scalar_i32(fixed_int32_t a, int32_t b) { 1581207e5cccSFangrui Song return a / b; 1582207e5cccSFangrui Song } 1583207e5cccSFangrui Song 1584207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_i64( 1585207e5cccSFangrui Song // CHECK-NEXT: entry: 1586207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1587207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1588207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1589207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = sdiv <8 x i64> [[A]], [[SPLAT_SPLAT]] 1590*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1591207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1592207e5cccSFangrui Song // 1593207e5cccSFangrui Song fixed_int64_t div_scalar_i64(fixed_int64_t a, int64_t b) { 1594207e5cccSFangrui Song return a / b; 1595207e5cccSFangrui Song } 1596207e5cccSFangrui Song 1597207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u8( 1598207e5cccSFangrui Song // CHECK-NEXT: entry: 1599207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1600207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1601207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1602207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <64 x i8> [[A]], [[SPLAT_SPLAT]] 1603*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[DIV]], i64 0) 1604207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1605207e5cccSFangrui Song // 1606207e5cccSFangrui Song fixed_uint8_t div_scalar_u8(fixed_uint8_t a, uint8_t b) { 1607207e5cccSFangrui Song return a / b; 1608207e5cccSFangrui Song } 1609207e5cccSFangrui Song 1610207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u16( 1611207e5cccSFangrui Song // CHECK-NEXT: entry: 1612207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1613207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1614207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1615207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <32 x i16> [[A]], [[SPLAT_SPLAT]] 1616*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[DIV]], i64 0) 1617207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1618207e5cccSFangrui Song // 1619207e5cccSFangrui Song fixed_uint16_t div_scalar_u16(fixed_uint16_t a, uint16_t b) { 1620207e5cccSFangrui Song return a / b; 1621207e5cccSFangrui Song } 1622207e5cccSFangrui Song 1623207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u32( 1624207e5cccSFangrui Song // CHECK-NEXT: entry: 1625207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1626207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1627207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1628207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <16 x i32> [[A]], [[SPLAT_SPLAT]] 1629*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[DIV]], i64 0) 1630207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1631207e5cccSFangrui Song // 1632207e5cccSFangrui Song fixed_uint32_t div_scalar_u32(fixed_uint32_t a, uint32_t b) { 1633207e5cccSFangrui Song return a / b; 1634207e5cccSFangrui Song } 1635207e5cccSFangrui Song 1636207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_u64( 1637207e5cccSFangrui Song // CHECK-NEXT: entry: 1638207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1639207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1640207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1641207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = udiv <8 x i64> [[A]], [[SPLAT_SPLAT]] 1642*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[DIV]], i64 0) 1643207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1644207e5cccSFangrui Song // 1645207e5cccSFangrui Song fixed_uint64_t div_scalar_u64(fixed_uint64_t a, uint64_t b) { 1646207e5cccSFangrui Song return a / b; 1647207e5cccSFangrui Song } 1648207e5cccSFangrui Song 1649207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f16( 1650207e5cccSFangrui Song // CHECK-NEXT: entry: 1651207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x half> @llvm.vector.extract.v32f16.nxv8f16(<vscale x 8 x half> [[A_COERCE:%.*]], i64 0) 1652207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x half> poison, half [[B:%.*]], i64 0 1653207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x half> [[SPLAT_SPLATINSERT]], <32 x half> poison, <32 x i32> zeroinitializer 1654207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <32 x half> [[A]], [[SPLAT_SPLAT]] 1655*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x half> @llvm.vector.insert.nxv8f16.v32f16(<vscale x 8 x half> poison, <32 x half> [[DIV]], i64 0) 1656207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x half> [[CASTSCALABLESVE]] 1657207e5cccSFangrui Song // 1658207e5cccSFangrui Song fixed_float16_t div_scalar_f16(fixed_float16_t a, __fp16 b) { 1659207e5cccSFangrui Song return a / b; 1660207e5cccSFangrui Song } 1661207e5cccSFangrui Song 1662207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f32( 1663207e5cccSFangrui Song // CHECK-NEXT: entry: 1664207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x float> @llvm.vector.extract.v16f32.nxv4f32(<vscale x 4 x float> [[A_COERCE:%.*]], i64 0) 1665207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x float> poison, float [[B:%.*]], i64 0 1666207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x float> [[SPLAT_SPLATINSERT]], <16 x float> poison, <16 x i32> zeroinitializer 1667207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <16 x float> [[A]], [[SPLAT_SPLAT]] 1668*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v16f32(<vscale x 4 x float> poison, <16 x float> [[DIV]], i64 0) 1669207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x float> [[CASTSCALABLESVE]] 1670207e5cccSFangrui Song // 1671207e5cccSFangrui Song fixed_float32_t div_scalar_f32(fixed_float32_t a, float b) { 1672207e5cccSFangrui Song return a / b; 1673207e5cccSFangrui Song } 1674207e5cccSFangrui Song 1675207e5cccSFangrui Song // CHECK-LABEL: @div_scalar_f64( 1676207e5cccSFangrui Song // CHECK-NEXT: entry: 1677207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x double> @llvm.vector.extract.v8f64.nxv2f64(<vscale x 2 x double> [[A_COERCE:%.*]], i64 0) 1678207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x double> poison, double [[B:%.*]], i64 0 1679207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x double> [[SPLAT_SPLATINSERT]], <8 x double> poison, <8 x i32> zeroinitializer 1680207e5cccSFangrui Song // CHECK-NEXT: [[DIV:%.*]] = fdiv <8 x double> [[A]], [[SPLAT_SPLAT]] 1681*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x double> @llvm.vector.insert.nxv2f64.v8f64(<vscale x 2 x double> poison, <8 x double> [[DIV]], i64 0) 1682207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x double> [[CASTSCALABLESVE]] 1683207e5cccSFangrui Song // 1684207e5cccSFangrui Song fixed_float64_t div_scalar_f64(fixed_float64_t a, double b) { 1685207e5cccSFangrui Song return a / b; 1686207e5cccSFangrui Song } 1687207e5cccSFangrui Song 1688207e5cccSFangrui Song // REMAINDER 1689207e5cccSFangrui Song 1690207e5cccSFangrui Song // CHECK-LABEL: @rem_i8( 1691207e5cccSFangrui Song // CHECK-NEXT: entry: 1692207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1693207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1694207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <64 x i8> [[A]], [[B]] 1695*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1696207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1697207e5cccSFangrui Song // 1698207e5cccSFangrui Song fixed_int8_t rem_i8(fixed_int8_t a, fixed_int8_t b) { 1699207e5cccSFangrui Song return a % b; 1700207e5cccSFangrui Song } 1701207e5cccSFangrui Song 1702207e5cccSFangrui Song // CHECK-LABEL: @rem_i16( 1703207e5cccSFangrui Song // CHECK-NEXT: entry: 1704207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1705207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1706207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <32 x i16> [[A]], [[B]] 1707*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1708207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1709207e5cccSFangrui Song // 1710207e5cccSFangrui Song fixed_int16_t rem_i16(fixed_int16_t a, fixed_int16_t b) { 1711207e5cccSFangrui Song return a % b; 1712207e5cccSFangrui Song } 1713207e5cccSFangrui Song 1714207e5cccSFangrui Song // CHECK-LABEL: @rem_i32( 1715207e5cccSFangrui Song // CHECK-NEXT: entry: 1716207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1717207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1718207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <16 x i32> [[A]], [[B]] 1719*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1720207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1721207e5cccSFangrui Song // 1722207e5cccSFangrui Song fixed_int32_t rem_i32(fixed_int32_t a, fixed_int32_t b) { 1723207e5cccSFangrui Song return a % b; 1724207e5cccSFangrui Song } 1725207e5cccSFangrui Song 1726207e5cccSFangrui Song // CHECK-LABEL: @rem_i64( 1727207e5cccSFangrui Song // CHECK-NEXT: entry: 1728207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1729207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1730207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <8 x i64> [[A]], [[B]] 1731*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1732207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1733207e5cccSFangrui Song // 1734207e5cccSFangrui Song fixed_int64_t rem_i64(fixed_int64_t a, fixed_int64_t b) { 1735207e5cccSFangrui Song return a % b; 1736207e5cccSFangrui Song } 1737207e5cccSFangrui Song 1738207e5cccSFangrui Song // CHECK-LABEL: @rem_u8( 1739207e5cccSFangrui Song // CHECK-NEXT: entry: 1740207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1741207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1742207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <64 x i8> [[A]], [[B]] 1743*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1744207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1745207e5cccSFangrui Song // 1746207e5cccSFangrui Song fixed_uint8_t rem_u8(fixed_uint8_t a, fixed_uint8_t b) { 1747207e5cccSFangrui Song return a % b; 1748207e5cccSFangrui Song } 1749207e5cccSFangrui Song 1750207e5cccSFangrui Song // CHECK-LABEL: @rem_u16( 1751207e5cccSFangrui Song // CHECK-NEXT: entry: 1752207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1753207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1754207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <32 x i16> [[A]], [[B]] 1755*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1756207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1757207e5cccSFangrui Song // 1758207e5cccSFangrui Song fixed_uint16_t rem_u16(fixed_uint16_t a, fixed_uint16_t b) { 1759207e5cccSFangrui Song return a % b; 1760207e5cccSFangrui Song } 1761207e5cccSFangrui Song 1762207e5cccSFangrui Song // CHECK-LABEL: @rem_u32( 1763207e5cccSFangrui Song // CHECK-NEXT: entry: 1764207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1765207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1766207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <16 x i32> [[A]], [[B]] 1767*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1768207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1769207e5cccSFangrui Song // 1770207e5cccSFangrui Song fixed_uint32_t rem_u32(fixed_uint32_t a, fixed_uint32_t b) { 1771207e5cccSFangrui Song return a % b; 1772207e5cccSFangrui Song } 1773207e5cccSFangrui Song 1774207e5cccSFangrui Song // CHECK-LABEL: @rem_u64( 1775207e5cccSFangrui Song // CHECK-NEXT: entry: 1776207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1777207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1778207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <8 x i64> [[A]], [[B]] 1779*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1780207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1781207e5cccSFangrui Song // 1782207e5cccSFangrui Song fixed_uint64_t rem_u64(fixed_uint64_t a, fixed_uint64_t b) { 1783207e5cccSFangrui Song return a % b; 1784207e5cccSFangrui Song } 1785207e5cccSFangrui Song 1786207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i8( 1787207e5cccSFangrui Song // CHECK-NEXT: entry: 1788207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1789207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1790207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <64 x i8> [[A]], [[B]] 1791*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1792207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1793207e5cccSFangrui Song // 1794207e5cccSFangrui Song fixed_int8_t rem_inplace_i8(fixed_int8_t a, fixed_int8_t b) { 1795207e5cccSFangrui Song return a % b; 1796207e5cccSFangrui Song } 1797207e5cccSFangrui Song 1798207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i16( 1799207e5cccSFangrui Song // CHECK-NEXT: entry: 1800207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1801207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1802207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <32 x i16> [[A]], [[B]] 1803*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1804207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1805207e5cccSFangrui Song // 1806207e5cccSFangrui Song fixed_int16_t rem_inplace_i16(fixed_int16_t a, fixed_int16_t b) { 1807207e5cccSFangrui Song return a % b; 1808207e5cccSFangrui Song } 1809207e5cccSFangrui Song 1810207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i32( 1811207e5cccSFangrui Song // CHECK-NEXT: entry: 1812207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1813207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1814207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <16 x i32> [[A]], [[B]] 1815*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1816207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1817207e5cccSFangrui Song // 1818207e5cccSFangrui Song fixed_int32_t rem_inplace_i32(fixed_int32_t a, fixed_int32_t b) { 1819207e5cccSFangrui Song return a % b; 1820207e5cccSFangrui Song } 1821207e5cccSFangrui Song 1822207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_i64( 1823207e5cccSFangrui Song // CHECK-NEXT: entry: 1824207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1825207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1826207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <8 x i64> [[A]], [[B]] 1827*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1828207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1829207e5cccSFangrui Song // 1830207e5cccSFangrui Song fixed_int64_t rem_inplace_i64(fixed_int64_t a, fixed_int64_t b) { 1831207e5cccSFangrui Song return a % b; 1832207e5cccSFangrui Song } 1833207e5cccSFangrui Song 1834207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u8( 1835207e5cccSFangrui Song // CHECK-NEXT: entry: 1836207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1837207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[B_COERCE:%.*]], i64 0) 1838207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <64 x i8> [[A]], [[B]] 1839*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1840207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1841207e5cccSFangrui Song // 1842207e5cccSFangrui Song fixed_uint8_t rem_inplace_u8(fixed_uint8_t a, fixed_uint8_t b) { 1843207e5cccSFangrui Song return a % b; 1844207e5cccSFangrui Song } 1845207e5cccSFangrui Song 1846207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u16( 1847207e5cccSFangrui Song // CHECK-NEXT: entry: 1848207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1849207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[B_COERCE:%.*]], i64 0) 1850207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <32 x i16> [[A]], [[B]] 1851*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1852207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1853207e5cccSFangrui Song // 1854207e5cccSFangrui Song fixed_uint16_t rem_inplace_u16(fixed_uint16_t a, fixed_uint16_t b) { 1855207e5cccSFangrui Song return a % b; 1856207e5cccSFangrui Song } 1857207e5cccSFangrui Song 1858207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u32( 1859207e5cccSFangrui Song // CHECK-NEXT: entry: 1860207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1861207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[B_COERCE:%.*]], i64 0) 1862207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <16 x i32> [[A]], [[B]] 1863*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1864207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1865207e5cccSFangrui Song // 1866207e5cccSFangrui Song fixed_uint32_t rem_inplace_u32(fixed_uint32_t a, fixed_uint32_t b) { 1867207e5cccSFangrui Song return a % b; 1868207e5cccSFangrui Song } 1869207e5cccSFangrui Song 1870207e5cccSFangrui Song // CHECK-LABEL: @rem_inplace_u64( 1871207e5cccSFangrui Song // CHECK-NEXT: entry: 1872207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1873207e5cccSFangrui Song // CHECK-NEXT: [[B:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[B_COERCE:%.*]], i64 0) 1874207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <8 x i64> [[A]], [[B]] 1875*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1876207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1877207e5cccSFangrui Song // 1878207e5cccSFangrui Song fixed_uint64_t rem_inplace_u64(fixed_uint64_t a, fixed_uint64_t b) { 1879207e5cccSFangrui Song return a % b; 1880207e5cccSFangrui Song } 1881207e5cccSFangrui Song 1882207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i8( 1883207e5cccSFangrui Song // CHECK-NEXT: entry: 1884207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1885207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1886207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1887207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <64 x i8> [[A]], [[SPLAT_SPLAT]] 1888*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1889207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1890207e5cccSFangrui Song // 1891207e5cccSFangrui Song fixed_int8_t rem_scalar_i8(fixed_int8_t a, int8_t b) { 1892207e5cccSFangrui Song return a % b; 1893207e5cccSFangrui Song } 1894207e5cccSFangrui Song 1895207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i16( 1896207e5cccSFangrui Song // CHECK-NEXT: entry: 1897207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1898207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1899207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1900207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <32 x i16> [[A]], [[SPLAT_SPLAT]] 1901*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1902207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1903207e5cccSFangrui Song // 1904207e5cccSFangrui Song fixed_int16_t rem_scalar_i16(fixed_int16_t a, int16_t b) { 1905207e5cccSFangrui Song return a % b; 1906207e5cccSFangrui Song } 1907207e5cccSFangrui Song 1908207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i32( 1909207e5cccSFangrui Song // CHECK-NEXT: entry: 1910207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1911207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1912207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1913207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <16 x i32> [[A]], [[SPLAT_SPLAT]] 1914*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1915207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1916207e5cccSFangrui Song // 1917207e5cccSFangrui Song fixed_int32_t rem_scalar_i32(fixed_int32_t a, int32_t b) { 1918207e5cccSFangrui Song return a % b; 1919207e5cccSFangrui Song } 1920207e5cccSFangrui Song 1921207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_i64( 1922207e5cccSFangrui Song // CHECK-NEXT: entry: 1923207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1924207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1925207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1926207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = srem <8 x i64> [[A]], [[SPLAT_SPLAT]] 1927*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1928207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1929207e5cccSFangrui Song // 1930207e5cccSFangrui Song fixed_int64_t rem_scalar_i64(fixed_int64_t a, int64_t b) { 1931207e5cccSFangrui Song return a % b; 1932207e5cccSFangrui Song } 1933207e5cccSFangrui Song 1934207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u8( 1935207e5cccSFangrui Song // CHECK-NEXT: entry: 1936207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <64 x i8> @llvm.vector.extract.v64i8.nxv16i8(<vscale x 16 x i8> [[A_COERCE:%.*]], i64 0) 1937207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <64 x i8> poison, i8 [[B:%.*]], i64 0 1938207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <64 x i8> [[SPLAT_SPLATINSERT]], <64 x i8> poison, <64 x i32> zeroinitializer 1939207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <64 x i8> [[A]], [[SPLAT_SPLAT]] 1940*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 16 x i8> @llvm.vector.insert.nxv16i8.v64i8(<vscale x 16 x i8> poison, <64 x i8> [[REM]], i64 0) 1941207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 16 x i8> [[CASTSCALABLESVE]] 1942207e5cccSFangrui Song // 1943207e5cccSFangrui Song fixed_uint8_t rem_scalar_u8(fixed_uint8_t a, uint8_t b) { 1944207e5cccSFangrui Song return a % b; 1945207e5cccSFangrui Song } 1946207e5cccSFangrui Song 1947207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u16( 1948207e5cccSFangrui Song // CHECK-NEXT: entry: 1949207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <32 x i16> @llvm.vector.extract.v32i16.nxv8i16(<vscale x 8 x i16> [[A_COERCE:%.*]], i64 0) 1950207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <32 x i16> poison, i16 [[B:%.*]], i64 0 1951207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <32 x i16> [[SPLAT_SPLATINSERT]], <32 x i16> poison, <32 x i32> zeroinitializer 1952207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <32 x i16> [[A]], [[SPLAT_SPLAT]] 1953*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 8 x i16> @llvm.vector.insert.nxv8i16.v32i16(<vscale x 8 x i16> poison, <32 x i16> [[REM]], i64 0) 1954207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 8 x i16> [[CASTSCALABLESVE]] 1955207e5cccSFangrui Song // 1956207e5cccSFangrui Song fixed_uint16_t rem_scalar_u16(fixed_uint16_t a, uint16_t b) { 1957207e5cccSFangrui Song return a % b; 1958207e5cccSFangrui Song } 1959207e5cccSFangrui Song 1960207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u32( 1961207e5cccSFangrui Song // CHECK-NEXT: entry: 1962207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <16 x i32> @llvm.vector.extract.v16i32.nxv4i32(<vscale x 4 x i32> [[A_COERCE:%.*]], i64 0) 1963207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <16 x i32> poison, i32 [[B:%.*]], i64 0 1964207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <16 x i32> [[SPLAT_SPLATINSERT]], <16 x i32> poison, <16 x i32> zeroinitializer 1965207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <16 x i32> [[A]], [[SPLAT_SPLAT]] 1966*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 4 x i32> @llvm.vector.insert.nxv4i32.v16i32(<vscale x 4 x i32> poison, <16 x i32> [[REM]], i64 0) 1967207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 4 x i32> [[CASTSCALABLESVE]] 1968207e5cccSFangrui Song // 1969207e5cccSFangrui Song fixed_uint32_t rem_scalar_u32(fixed_uint32_t a, uint32_t b) { 1970207e5cccSFangrui Song return a % b; 1971207e5cccSFangrui Song } 1972207e5cccSFangrui Song 1973207e5cccSFangrui Song // CHECK-LABEL: @rem_scalar_u64( 1974207e5cccSFangrui Song // CHECK-NEXT: entry: 1975207e5cccSFangrui Song // CHECK-NEXT: [[A:%.*]] = call <8 x i64> @llvm.vector.extract.v8i64.nxv2i64(<vscale x 2 x i64> [[A_COERCE:%.*]], i64 0) 1976207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLATINSERT:%.*]] = insertelement <8 x i64> poison, i64 [[B:%.*]], i64 0 1977207e5cccSFangrui Song // CHECK-NEXT: [[SPLAT_SPLAT:%.*]] = shufflevector <8 x i64> [[SPLAT_SPLATINSERT]], <8 x i64> poison, <8 x i32> zeroinitializer 1978207e5cccSFangrui Song // CHECK-NEXT: [[REM:%.*]] = urem <8 x i64> [[A]], [[SPLAT_SPLAT]] 1979*98e747baSPedro Lobo // CHECK-NEXT: [[CASTSCALABLESVE:%.*]] = call <vscale x 2 x i64> @llvm.vector.insert.nxv2i64.v8i64(<vscale x 2 x i64> poison, <8 x i64> [[REM]], i64 0) 1980207e5cccSFangrui Song // CHECK-NEXT: ret <vscale x 2 x i64> [[CASTSCALABLESVE]] 1981207e5cccSFangrui Song // 1982207e5cccSFangrui Song fixed_uint64_t rem_scalar_u64(fixed_uint64_t a, uint64_t b) { 1983207e5cccSFangrui Song return a % b; 1984207e5cccSFangrui Song } 1985