[AArch64][FastISel] Fix integer extend optimization.
[oota-llvm.git] / test / CodeGen / AArch64 / concat_vector-truncate-combine.ll
1 ; RUN: llc < %s -mtriple arm64-apple-darwin -asm-verbose=false | FileCheck %s
2
3 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
4
5 define <4 x i16> @test_concat_truncate_v2i64_to_v4i16(<2 x i64> %a, <2 x i64> %b) #0 {
6 entry:
7 ; CHECK-LABEL: test_concat_truncate_v2i64_to_v4i16:
8 ; CHECK-NEXT: uzp1.4s v0, v0, v1
9 ; CHECK-NEXT: xtn.4h v0, v0
10 ; CHECK-NEXT: ret
11   %at = trunc <2 x i64> %a to <2 x i16>
12   %bt = trunc <2 x i64> %b to <2 x i16>
13   %shuffle = shufflevector <2 x i16> %at, <2 x i16> %bt, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
14   ret <4 x i16> %shuffle
15 }
16
17 define <8 x i8> @test_concat_truncate_v4i32_to_v8i8(<4 x i32> %a, <4 x i32> %b) #0 {
18 entry:
19 ; CHECK-LABEL: test_concat_truncate_v4i32_to_v8i8:
20 ; CHECK-NEXT: uzp1.8h v0, v0, v1
21 ; CHECK-NEXT: xtn.8b v0, v0
22 ; CHECK-NEXT: ret
23   %at = trunc <4 x i32> %a to <4 x i8>
24   %bt = trunc <4 x i32> %b to <4 x i8>
25   %shuffle = shufflevector <4 x i8> %at, <4 x i8> %bt, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
26   ret <8 x i8> %shuffle
27 }
28
29 define <8 x i16> @test_concat_truncate_v4i32_to_v8i16(<4 x i32> %a, <4 x i32> %b) #0 {
30 entry:
31 ; CHECK-LABEL: test_concat_truncate_v4i32_to_v8i16:
32 ; CHECK-NEXT: xtn.4h v0, v0
33 ; CHECK-NEXT: xtn2.8h v0, v1
34 ; CHECK-NEXT: ret
35   %at = trunc <4 x i32> %a to <4 x i16>
36   %bt = trunc <4 x i32> %b to <4 x i16>
37   %shuffle = shufflevector <4 x i16> %at, <4 x i16> %bt, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
38   ret <8 x i16> %shuffle
39 }
40
41 attributes #0 = { nounwind }