1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple aarch64-none-linux-gnu | FileCheck %s
4 ; Test the (concat_vectors (X), (trunc(smin(smax(Y, -2^n), 2^n-1))) pattern.
6 define <16 x i8> @test_combine_v8i16_to_v16i8(<8 x i8> %x, <8 x i16> %y) {
7 ; CHECK-LABEL: test_combine_v8i16_to_v16i8:
8 ; CHECK: // %bb.0: // %entry
9 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
10 ; CHECK-NEXT: sqxtn2 v0.16b, v1.8h
13 %min = call <8 x i16> @llvm.smin.v8i16(<8 x i16> %y, <8 x i16> <i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127, i16 127>)
14 %max = call <8 x i16> @llvm.smax.v8i16(<8 x i16> %min, <8 x i16> <i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128, i16 -128>)
15 %trunc = trunc <8 x i16> %max to <8 x i8>
16 %shuffle = shufflevector <8 x i8> %x, <8 x i8> %trunc, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
17 ret <16 x i8> %shuffle
20 define <8 x i16> @test_combine_v4i32_to_v8i16(<4 x i16> %x, <4 x i32> %y) {
21 ; CHECK-LABEL: test_combine_v4i32_to_v8i16:
22 ; CHECK: // %bb.0: // %entry
23 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
24 ; CHECK-NEXT: sqxtn2 v0.8h, v1.4s
27 %max = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %y, <4 x i32> <i32 -32768, i32 -32768, i32 -32768, i32 -32768>)
28 %min = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %max, <4 x i32> <i32 32767, i32 32767, i32 32767, i32 32767>)
29 %trunc = trunc <4 x i32> %min to <4 x i16>
30 %shuffle = shufflevector <4 x i16> %x, <4 x i16> %trunc, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
31 ret <8 x i16> %shuffle
34 declare <8 x i16> @llvm.smin.v8i16(<8 x i16>, <8 x i16>)
35 declare <8 x i16> @llvm.smax.v8i16(<8 x i16>, <8 x i16>)
36 declare <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>)
37 declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>)