1; This file tests bitcasts of vector type. For most operations, these 2; should be lowered to a no-op on -O2. 3 4; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8632 --args -O2 \ 5; RUN: | FileCheck --check-prefix=X86-O2 --check-prefix=X86 %s 6; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8632 --args -Om1 \ 7; RUN: | FileCheck --check-prefix=X86 %s 8 9; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8664 --args -O2 \ 10; RUN: | FileCheck --check-prefix=X86-O2 --check-prefix=X86 %s 11; RUN: %p2i -i %s --filetype=obj --disassemble --target=x8664 --args -Om1 \ 12; RUN: | FileCheck --check-prefix=X86 %s 13 14; RUN: %p2i -i %s --filetype=obj --disassemble --target=arm32 --args -O2 \ 15; RUN: | FileCheck --check-prefix=ARM32-O2-O2 --check-prefix=ARM32 %s 16; RUN: %p2i -i %s --filetype=obj --disassemble --target=arm32 --args -Om1 \ 17; RUN: | FileCheck --check-prefix=ARM32 %s 18 19define internal <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) { 20entry: 21 %res = bitcast <16 x i8> %arg to <16 x i8> 22 ret <16 x i8> %res 23 24; X86-O2-LABEL: test_bitcast_v16i8_to_v16i8 25; X86-O2-NEXT: ret 26 27; ARM32-O2-LABEL: test_bitcast_v16i8_to_v16i8 28; ARM32-O2-NEXT: bx 29} 30 31define internal <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) { 32entry: 33 %res = bitcast <16 x i8> %arg to <8 x i16> 34 ret <8 x i16> %res 35 36; X86-O2-LABEL: test_bitcast_v16i8_to_v8i16 37; X86-O2-NEXT: ret 38 39; ARM32-O2-LABEL: test_bitcast_v16i8_to_v8i16 40; ARM32-O2-NEXT: bx 41} 42 43define internal <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) { 44entry: 45 %res = bitcast <16 x i8> %arg to <4 x i32> 46 ret <4 x i32> %res 47 48; X86-O2-LABEL: test_bitcast_v16i8_to_v4i32 49; X86-O2-NEXT: ret 50 51; ARM32-O2-LABEL: test_bitcast_v16i8_to_v4i32 52; ARM32-O2-NEXT: bx 53} 54 55define internal <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) { 56entry: 57 %res = bitcast <16 x i8> %arg to <4 x float> 58 ret <4 x float> %res 59 60; X86-O2-LABEL: test_bitcast_v16i8_to_v4f32 61; X86-O2-NEXT: ret 62 63; ARM32-O2-LABEL: test_bitcast_v16i8_to_v4f32 64; ARM32-O2-NEXT: bx 65} 66 67define internal <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) { 68entry: 69 %res = bitcast <8 x i16> %arg to <16 x i8> 70 ret <16 x i8> %res 71 72; X86-O2-LABEL: test_bitcast_v8i16_to_v16i8 73; X86-O2-NEXT: ret 74 75; ARM32-O2-LABEL: test_bitcast_v8i16_to_v16i8 76; ARM32-O2-NEXT: bx 77} 78 79define internal <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) { 80entry: 81 %res = bitcast <8 x i16> %arg to <8 x i16> 82 ret <8 x i16> %res 83 84; X86-O2-LABEL: test_bitcast_v8i16_to_v8i16 85; X86-O2-NEXT: ret 86 87; ARM32-O2-LABEL: test_bitcast_v8i16_to_v8i16 88; ARM32-O2-NEXT: bx 89} 90 91define internal <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) { 92entry: 93 %res = bitcast <8 x i16> %arg to <4 x i32> 94 ret <4 x i32> %res 95 96; X86-O2-LABEL: test_bitcast_v8i16_to_v4i32 97; X86-O2-NEXT: ret 98 99; ARM32-O2-LABEL: test_bitcast_v8i16_to_v4i32 100; ARM32-O2-NEXT: bx 101} 102 103define internal <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) { 104entry: 105 %res = bitcast <8 x i16> %arg to <4 x float> 106 ret <4 x float> %res 107 108; X86-O2-LABEL: test_bitcast_v8i16_to_v4f32 109; X86-O2-NEXT: ret 110 111; ARM32-O2-LABEL: test_bitcast_v8i16_to_v4f32 112; ARM32-O2-NEXT: bx 113} 114 115define internal <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) { 116entry: 117 %res = bitcast <4 x i32> %arg to <16 x i8> 118 ret <16 x i8> %res 119 120; X86-O2-LABEL: test_bitcast_v4i32_to_v16i8 121; X86-O2-NEXT: ret 122 123; ARM32-O2-LABEL: test_bitcast_v4i32_to_v16i8 124; ARM32-O2-NEXT: bx 125} 126 127define internal <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) { 128entry: 129 %res = bitcast <4 x i32> %arg to <8 x i16> 130 ret <8 x i16> %res 131 132; X86-O2-LABEL: test_bitcast_v4i32_to_v8i16 133; X86-O2-NEXT: ret 134 135; ARM32-O2-LABEL: test_bitcast_v4i32_to_v8i16 136; ARM32-O2-NEXT: bx 137} 138 139define internal <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) { 140entry: 141 %res = bitcast <4 x i32> %arg to <4 x i32> 142 ret <4 x i32> %res 143 144; X86-O2-LABEL: test_bitcast_v4i32_to_v4i32 145; X86-O2-NEXT: ret 146 147; ARM32-O2-LABEL: test_bitcast_v4i32_to_v4i32 148; ARM32-O2-NEXT: bx 149} 150 151define internal <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) { 152entry: 153 %res = bitcast <4 x i32> %arg to <4 x float> 154 ret <4 x float> %res 155 156; X86-O2-LABEL: test_bitcast_v4i32_to_v4f32 157; X86-O2-NEXT: ret 158 159; ARM32-O2-LABEL: test_bitcast_v4i32_to_v4f32 160; ARM32-O2-NEXT: bx 161} 162 163define internal <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) { 164entry: 165 %res = bitcast <4 x float> %arg to <16 x i8> 166 ret <16 x i8> %res 167 168; X86-O2-LABEL: test_bitcast_v4f32_to_v16i8 169; X86-O2-NEXT: ret 170 171; ARM32-O2-LABEL: test_bitcast_v4f32_to_v16i8 172; ARM32-O2-NEXT: bx 173} 174 175define internal <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) { 176entry: 177 %res = bitcast <4 x float> %arg to <8 x i16> 178 ret <8 x i16> %res 179 180; X86-O2-LABEL: test_bitcast_v4f32_to_v8i16 181; X86-O2-NEXT: ret 182 183; ARM32-O2-LABEL: test_bitcast_v4f32_to_v8i16 184; ARM32-O2-NEXT: bx 185} 186 187define internal <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) { 188entry: 189 %res = bitcast <4 x float> %arg to <4 x i32> 190 ret <4 x i32> %res 191 192; X86-O2-LABEL: test_bitcast_v4f32_to_v4i32 193; X86-O2-NEXT: ret 194 195; ARM32-O2-LABEL: test_bitcast_v4f32_to_v4i32 196; ARM32-O2-NEXT: bx 197} 198 199define internal <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) { 200entry: 201 %res = bitcast <4 x float> %arg to <4 x float> 202 ret <4 x float> %res 203 204; X86-O2-LABEL: test_bitcast_v4f32_to_v4f32 205; X86-O2-NEXT: ret 206 207; ARM32-O2-LABEL: test_bitcast_v4f32_to_v4f32 208; ARM32-O2-NEXT: bx 209} 210 211define internal i32 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) { 212entry: 213 %res = bitcast <8 x i1> %arg to i8 214 %res.i32 = zext i8 %res to i32 215 ret i32 %res.i32 216 217; X86-LABEL: test_bitcast_v8i1_to_i8 218; X86: call {{.*}} R_{{.*}} __Sz_bitcast_8xi1_i8 219 220; ARM32-LABEL: test_bitcast_v8i1_to_i8 221; ARM32: bl {{.*}} __Sz_bitcast_8xi1_i8 222} 223 224define internal i32 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) { 225entry: 226 %res = bitcast <16 x i1> %arg to i16 227 %res.i32 = zext i16 %res to i32 228 ret i32 %res.i32 229 230; X86-LABEL: test_bitcast_v16i1_to_i16 231; X86: call {{.*}} __Sz_bitcast_16xi1_i16 232 233; ARM32-LABEL: test_bitcast_v16i1_to_i16 234; ARM32: bl {{.*}} __Sz_bitcast_16xi1_i16 235} 236 237define internal <8 x i1> @test_bitcast_i8_to_v8i1(i32 %arg) { 238entry: 239 %arg.trunc = trunc i32 %arg to i8 240 %res = bitcast i8 %arg.trunc to <8 x i1> 241 ret <8 x i1> %res 242 243; X86-LABEL: test_bitcast_i8_to_v8i1 244; X86: call {{.*}} R_{{.*}} __Sz_bitcast_i8_8xi1 245 246; ARM32-LABEL: test_bitcast_i8_to_v8i1 247; ARM32: bl {{.*}} __Sz_bitcast_i8_8xi1 248} 249 250define internal <16 x i1> @test_bitcast_i16_to_v16i1(i32 %arg) { 251entry: 252 %arg.trunc = trunc i32 %arg to i16 253 %res = bitcast i16 %arg.trunc to <16 x i1> 254 ret <16 x i1> %res 255 256; X86-LABEL: test_bitcast_i16_to_v16i1 257; X86: call {{.*}} R_{{.*}} __Sz_bitcast_i16_16xi1 258 259; ARM32-LABEL: test_bitcast_i16_to_v16i1 260; ARM32: bl {{.*}} __Sz_bitcast_i16_16xi1 261} 262