1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=arm64-unknown-unknown < %s -o -| FileCheck %s
4 ; This test covers a case where extract_vector_elt is selected when DUP is
5 ; generated. Where it tries to generate a ZextOrTrunc node with floating point
6 ; type resulting in a crash.
7 ; See https://reviews.llvm.org/D128144#4280024 for context
8 define double @dot_product(double %a) {
9 ; CHECK-LABEL: dot_product:
10 ; CHECK: // %bb.0: // %entry
11 ; CHECK-NEXT: fmov d1, #1.00000000
12 ; CHECK-NEXT: fadd d0, d0, d1
13 ; CHECK-NEXT: fadd d0, d0, d1
14 ; CHECK-NEXT: movi d1, #0000000000000000
15 ; CHECK-NEXT: fadd d0, d0, d1
16 ; CHECK-NEXT: fsqrt d0, d0
17 ; CHECK-NEXT: fmul d2, d0, d1
18 ; CHECK-NEXT: fcmp d0, #0.0
19 ; CHECK-NEXT: fcsel d0, d1, d2, gt
22 %fadd = call double @llvm.vector.reduce.fadd.v3f64(double %a, <3 x double> <double 1.000000e+00, double 1.000000e+00, double 0.000000e+00>)
23 %sqrt = call double @llvm.sqrt.f64(double %fadd)
24 %insert = insertelement <3 x double> zeroinitializer, double %sqrt, i64 0
25 %shuffle = shufflevector <3 x double> %insert, <3 x double> zeroinitializer, <3 x i32> zeroinitializer
26 %mul = fmul <3 x double> %shuffle, <double 1.000000e+00, double 1.000000e+00, double 0.000000e+00>
27 %shuffle.1 = extractelement <3 x double> %mul, i64 0
28 %shuffle.2 = extractelement <3 x double> %mul, i64 1
29 %cmp = fcmp ogt double %shuffle.2, 0.000000e+00
30 br i1 %cmp, label %exit, label %bb.1
33 %mul.2 = fmul double %shuffle.1, 0.000000e+00
40 declare double @llvm.sqrt.f64(double)
41 declare double @llvm.vector.reduce.fadd.v3f64(double, <3 x double>)