1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3; Test that the compiler generates the correct code when sign-extending a
4; predicate register when it is converted from one vector predicate type
5; to another. In this case, the compiler generates two v4i1 EXTRACT_SUBVECT
6; from a v8i1, for the lower and upper parts.
7
8; CHECK: r[[REGH:([0-9]+)]]:[[REGL:([0-9]+)]] = mask(p{{[0-3]}})
9; CHECK-DAG: = vsxtbh(r[[REGH]])
10; CHECK-DAG: = vsxtbh(r[[REGL]])
11
12target triple = "hexagon"
13
14define void @f0(i16* %a0, <8 x i16>* %a1) #0 {
15b0:
16  %v0 = load i16, i16* %a0, align 2
17  %v1 = sext i16 %v0 to i32
18  %v2 = insertelement <8 x i32> undef, i32 %v1, i32 0
19  %v3 = shufflevector <8 x i32> %v2, <8 x i32> undef, <8 x i32> zeroinitializer
20  %v4 = shl <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>, <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
21  %v5 = and <8 x i32> %v4, %v3
22  %v6 = icmp ne <8 x i32> %v5, zeroinitializer
23  %v7 = zext <8 x i1> %v6 to <8 x i16>
24  store <8 x i16> %v7, <8 x i16>* %a1, align 8
25  ret void
26}
27
28attributes #0 = { nounwind optsize "target-cpu"="hexagonv65" "target-features"="+hvx-length64b,+hvxv65,-long-calls" }
29