|
| 1 | +// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s |
| 2 | + |
| 3 | +typedef __attribute__((__ext_vector_type__(8))) char vector_char8; |
| 4 | +typedef __attribute__((__ext_vector_type__(8))) short vector_short8; |
| 5 | +typedef __attribute__((__ext_vector_type__(8))) int vector_int8; |
| 6 | +typedef __attribute__((__ext_vector_type__(8))) unsigned char vector_uchar8; |
| 7 | +typedef __attribute__((__ext_vector_type__(8))) unsigned short vector_ushort8; |
| 8 | +typedef __attribute__((__ext_vector_type__(8))) unsigned int vector_uint8; |
| 9 | +typedef __attribute__((__ext_vector_type__(4))) char vector_char4; |
| 10 | +typedef __attribute__((__ext_vector_type__(4))) short vector_short4; |
| 11 | +typedef __attribute__((__ext_vector_type__(4))) int vector_int4; |
| 12 | +typedef __attribute__((__ext_vector_type__(4))) unsigned char vector_uchar4; |
| 13 | +typedef __attribute__((__ext_vector_type__(4))) unsigned short vector_ushort4; |
| 14 | +typedef __attribute__((__ext_vector_type__(4))) unsigned int vector_uint4; |
| 15 | + |
| 16 | +char c; |
| 17 | +short s; |
| 18 | +int i; |
| 19 | +unsigned char uc; |
| 20 | +unsigned short us; |
| 21 | +unsigned int ui; |
| 22 | +vector_char8 vc8; |
| 23 | +vector_short8 vs8; |
| 24 | +vector_int8 vi8; |
| 25 | +vector_uchar8 vuc8; |
| 26 | +vector_ushort8 vus8; |
| 27 | +vector_uint8 vui8; |
| 28 | +vector_char4 vc4; |
| 29 | +vector_short4 vs4; |
| 30 | +vector_int4 vi4; |
| 31 | +vector_uchar4 vuc4; |
| 32 | +vector_ushort4 vus4; |
| 33 | +vector_uint4 vui4; |
| 34 | + |
| 35 | +void foo() { |
| 36 | + vc8 = 1 << vc8; |
| 37 | +// CHECK: [[t0:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 38 | +// CHECK: shl <8 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, [[t0]] |
| 39 | + vuc8 = 1 << vuc8; |
| 40 | +// CHECK: [[t1:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 41 | +// CHECK: shl <8 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>, [[t1]] |
| 42 | + vi8 = 1 << vi8; |
| 43 | +// CHECK: [[t2:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 44 | +// CHECK: shl <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, [[t2]] |
| 45 | + vui8 = 1 << vui8; |
| 46 | +// CHECK: [[t3:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 47 | +// CHECK: shl <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, [[t3]] |
| 48 | + vs8 = 1 << vs8; |
| 49 | +// CHECK: [[t4:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 50 | +// CHECK: shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, [[t4]] |
| 51 | + vus8 = 1 << vus8; |
| 52 | +// CHECK: [[t5:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 53 | +// CHECK: shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, [[t5]] |
| 54 | + |
| 55 | + vc8 = c << vc8; |
| 56 | +// CHECK: [[t6:%.+]] = load i8, i8* @c, |
| 57 | +// CHECK: [[splat_splatinsert:%.+]] = insertelement <8 x i8> undef, i8 [[t6]], i32 0 |
| 58 | +// CHECK: [[splat_splat:%.+]] = shufflevector <8 x i8> [[splat_splatinsert]], <8 x i8> undef, <8 x i32> zeroinitializer |
| 59 | +// CHECK: [[t7:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 60 | +// CHECK: shl <8 x i8> [[splat_splat]], [[t7]] |
| 61 | + vuc8 = i << vuc8; |
| 62 | +// CHECK: [[t8:%.+]] = load i32, i32* @i, |
| 63 | +// CHECK: [[tconv:%.+]] = trunc i32 [[t8]] to i8 |
| 64 | +// CHECK: [[splat_splatinsert7:%.+]] = insertelement <8 x i8> undef, i8 [[tconv]], i32 0 |
| 65 | +// CHECK: [[splat_splat8:%.+]] = shufflevector <8 x i8> [[splat_splatinsert7]], <8 x i8> undef, <8 x i32> zeroinitializer |
| 66 | +// CHECK: [[t9:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 67 | +// CHECK: shl <8 x i8> [[splat_splat8]], [[t9]] |
| 68 | + vi8 = uc << vi8; |
| 69 | +// CHECK: [[t10:%.+]] = load i8, i8* @uc, |
| 70 | +// CHECK: [[conv10:%.+]] = zext i8 [[t10]] to i32 |
| 71 | +// CHECK: [[splat_splatinsert11:%.+]] = insertelement <8 x i32> undef, i32 [[conv10]], i32 0 |
| 72 | +// CHECK: [[splat_splat12:%.+]] = shufflevector <8 x i32> [[splat_splatinsert11]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 73 | +// CHECK: [[t11:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 74 | +// CHECK: shl <8 x i32> [[splat_splat12]], [[t11]] |
| 75 | + vui8 = us << vui8; |
| 76 | +// CHECK: [[t12:%.+]] = load i16, i16* @us, |
| 77 | +// CHECK: [[conv14:%.+]] = zext i16 [[t12]] to i32 |
| 78 | +// CHECK: [[splat_splatinsert15:%.+]] = insertelement <8 x i32> undef, i32 [[conv14]], i32 0 |
| 79 | +// CHECK: [[splat_splat16:%.+]] = shufflevector <8 x i32> [[splat_splatinsert15]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 80 | +// CHECK: [[t13:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 81 | +// CHECK: shl <8 x i32> [[splat_splat16]], [[t13]] |
| 82 | + vs8 = ui << vs8; |
| 83 | +// CHECK: [[t14:%.+]] = load i32, i32* @ui, |
| 84 | +// CHECK: [[conv18:%.+]] = trunc i32 [[t14]] to i16 |
| 85 | +// CHECK: [[splat_splatinsert19:%.+]] = insertelement <8 x i16> undef, i16 [[conv18]], i32 0 |
| 86 | +// CHECK: [[splat_splat20:%.+]] = shufflevector <8 x i16> [[splat_splatinsert19]], <8 x i16> undef, <8 x i32> zeroinitializer |
| 87 | +// CHECK: [[t15:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 88 | +// CHECK: shl <8 x i16> [[splat_splat20]], [[t15]] |
| 89 | + vus8 = 1 << vus8; |
| 90 | +// CHECK: [[t16:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 91 | +// CHECK: [[shl22:%.+]] = shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, [[t16]] |
| 92 | + |
| 93 | + vc8 = vc8 << vc8; |
| 94 | +// CHECK: [[t17:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 95 | +// CHECK: [[t18:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 96 | +// CHECK: shl <8 x i8> [[t17]], [[t18]] |
| 97 | + vi8 = vi8 << vuc8; |
| 98 | +// CHECK: [[t19:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 99 | +// CHECK: [[t20:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 100 | +// CHECK: [[shprom:%.+]] = zext <8 x i8> [[t20]] to <8 x i32> |
| 101 | +// CHECK: shl <8 x i32> [[t19]], [[shprom]] |
| 102 | + vuc8 = vuc8 << vi8; |
| 103 | +// CHECK: [[t21:%.+]] = load <8 x i8>, <8 x i8>* {{@.+}}, |
| 104 | +// CHECK: [[t22:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 105 | +// CHECK: [[sh_prom25:%.+]] = trunc <8 x i32> [[t22]] to <8 x i8> |
| 106 | +// CHECK: shl <8 x i8> [[t21]], [[sh_prom25]] |
| 107 | + vus8 = vus8 << vui8; |
| 108 | +// CHECK: [[t23:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 109 | +// CHECK: [[t24:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 110 | +// CHECK: [[sh_prom27:%.+]] = trunc <8 x i32> [[t24]] to <8 x i16> |
| 111 | +// CHECK: shl <8 x i16> [[t23]], [[sh_prom27]] |
| 112 | + vui8 = vui8 << vs8; |
| 113 | +// CHECK: [[t25:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 114 | +// CHECK: [[t26:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 115 | +// CHECK: [[sh_prom29:%.+]] = zext <8 x i16> [[t26]] to <8 x i32> |
| 116 | +// CHECK: shl <8 x i32> [[t25]], [[sh_prom29]] |
| 117 | + |
| 118 | + vui8 <<= s; |
| 119 | +// CHECK: [[t27:%.+]] = load i16, i16* @s, |
| 120 | +// CHECK: [[conv40:%.+]] = sext i16 [[t27]] to i32 |
| 121 | +// CHECK: [[splat_splatinsert41:%.+]] = insertelement <8 x i32> undef, i32 [[conv40]], i32 0 |
| 122 | +// CHECK: [[splat_splat42:%.+]] = shufflevector <8 x i32> [[splat_splatinsert41]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 123 | +// CHECK: [[t28:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 124 | +// CHECK: shl <8 x i32> [[t28]], [[splat_splat42]] |
| 125 | + vi8 <<= us; |
| 126 | +// CHECK: [[t29:%.+]] = load i16, i16* @us, |
| 127 | +// CHECK: [[conv44:%.+]] = zext i16 [[t29]] to i32 |
| 128 | +// CHECK: [[splat_splatinsert45:%.+]] = insertelement <8 x i32> undef, i32 [[conv44]], i32 0 |
| 129 | +// CHECK: [[splat_splat46:%.+]] = shufflevector <8 x i32> [[splat_splatinsert45]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 130 | +// CHECK: [[t30:%.+]] = load <8 x i32>, <8 x i32>* {{@.+}}, |
| 131 | +// CHECK: shl <8 x i32> [[t30]], [[splat_splat46]] |
| 132 | + vus8 <<= i; |
| 133 | +// CHECK: [[t31:%.+]] = load i32, i32* @i, |
| 134 | +// CHECK: [[splat_splatinsert48:%.+]] = insertelement <8 x i32> undef, i32 [[t31]], i32 0 |
| 135 | +// CHECK: [[splat_splat49:%.+]] = shufflevector <8 x i32> [[splat_splatinsert48]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 136 | +// CHECK: [[t32:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 137 | +// CHECK: [[sh_prom50:%.+]] = trunc <8 x i32> [[splat_splat49]] to <8 x i16> |
| 138 | +// CHECK: shl <8 x i16> [[t32]], [[sh_prom50]] |
| 139 | + vs8 <<= ui; |
| 140 | +// CHECK: [[t33:%.+]] = load i32, i32* @ui, |
| 141 | +// CHECK: [[splat_splatinsert52:%.+]] = insertelement <8 x i32> undef, i32 [[t33]], i32 0 |
| 142 | +// CHECK: [[splat_splat53:%.+]] = shufflevector <8 x i32> [[splat_splatinsert52]], <8 x i32> undef, <8 x i32> zeroinitializer |
| 143 | +// CHECK: [[t34:%.+]] = load <8 x i16>, <8 x i16>* {{@.+}}, |
| 144 | +// CHECK: [[sh_prom54:%.+]] = trunc <8 x i32> [[splat_splat53]] to <8 x i16> |
| 145 | +// CHECK: shl <8 x i16> [[t34]], [[sh_prom54]] |
| 146 | +} |
0 commit comments