1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -o -| FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64-unknown-linux-gnu"
7 ; This test covers a case where an AArch64 DUP instruction is generated with an
8 ; invalid encoding, resulting in a crash. We don't care about the specific output
9 ; here, only that this case no longer causes said crash.
10 define dso_local i32 @dupext_crashtest(i32 %e) local_unnamed_addr {
11 ; CHECK-LABEL: dupext_crashtest:
12 ; CHECK: // %bb.0: // %for.body.lr.ph
13 ; CHECK-NEXT: mov w8, w0
14 ; CHECK-NEXT: dup v0.2s, w8
15 ; CHECK-NEXT: .LBB0_1: // %vector.body
16 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
17 ; CHECK-NEXT: ldr d1, [x8]
18 ; CHECK-NEXT: smull v1.2d, v0.2s, v1.2s
19 ; CHECK-NEXT: xtn v1.2s, v1.2d
20 ; CHECK-NEXT: str d1, [x8]
21 ; CHECK-NEXT: b .LBB0_1
23 %conv314 = zext i32 %e to i64
24 br label %vector.memcheck
26 vector.memcheck: ; preds = %for.body.lr.ph
29 vector.ph: ; preds = %vector.memcheck
30 %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %conv314, i32 0
31 %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
34 vector.body: ; preds = %vector.body, %vector.ph
35 %wide.load = load <2 x i32>, <2 x i32>* undef, align 4
36 %0 = zext <2 x i32> %wide.load to <2 x i64>
37 %1 = mul nuw <2 x i64> %broadcast.splat, %0
38 %2 = trunc <2 x i64> %1 to <2 x i32>
39 %3 = select <2 x i1> undef, <2 x i32> undef, <2 x i32> %2
40 %4 = bitcast i32* undef to <2 x i32>*
41 store <2 x i32> %3, <2 x i32>* %4, align 4