1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=arm64-eabi | FileCheck %s
3
4define float @t1(i1 %a, float %b, float %c) nounwind {
5; CHECK-LABEL: t1:
6; CHECK:       // %bb.0:
7; CHECK-NEXT:    tst w0, #0x1
8; CHECK-NEXT:    fcsel s0, s0, s1, ne
9; CHECK-NEXT:    ret
10  %sel = select i1 %a, float %b, float %c
11  ret float %sel
12}
13
14; This may infinite loop if isNegatibleForFree and getNegatedExpression are conflicted.
15
16define double @negation_propagation(double* %arg, double %arg1, double %arg2) {
17; CHECK-LABEL: negation_propagation:
18; CHECK:       // %bb.0:
19; CHECK-NEXT:    fmov d2, #1.00000000
20; CHECK-NEXT:    fdiv d0, d2, d0
21; CHECK-NEXT:    fmul d2, d0, d0
22; CHECK-NEXT:    fmul d1, d0, d1
23; CHECK-NEXT:    fmul d0, d0, d2
24; CHECK-NEXT:    fsub d0, d1, d0
25; CHECK-NEXT:    ret
26  %t = fdiv double 1.0, %arg1
27  %t7 = fmul double %t, %arg2
28  %t10 = fneg double %t7
29  %t11 = fmul double %t, %t
30  %t13 = fsub double %t11, %t
31  %t14 = fneg double %t
32  %t15 = fmul double %t, %t14
33  %t16 = fmul double %t, %t15
34  %t18 = fadd double %t16, %t7
35  ret double %t18
36}
37
38define { double, double } @testfn(double %x, double %y) #0 {
39; CHECK-LABEL: testfn:
40; CHECK:       // %bb.0:
41; CHECK-NEXT:    fsub d0, d0, d1
42; CHECK-NEXT:    fneg d1, d0
43; CHECK-NEXT:    ret
44  %sub = fsub fast double %x, %y
45  %neg = fneg fast double %sub
46  %r0 = insertvalue { double, double } undef, double %sub, 0
47  %r1 = insertvalue { double, double } %r0, double %neg, 1
48  ret { double, double } %r1
49}
50
51define <2 x float> @fake_fneg_splat_extract(<4 x float> %rhs) {
52; CHECK-LABEL: fake_fneg_splat_extract:
53; CHECK:       // %bb.0:
54; CHECK-NEXT:    fneg v0.4s, v0.4s
55; CHECK-NEXT:    dup v0.2s, v0.s[3]
56; CHECK-NEXT:    ret
57  %rhs_neg = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %rhs
58  %splat = shufflevector <4 x float> %rhs_neg, <4 x float> undef, <2 x i32> <i32 3, i32 3>
59  ret <2 x float> %splat
60}
61
62define <2 x float> @fake_fneg_splat_extract_undef(<4 x float> %rhs) {
63; CHECK-LABEL: fake_fneg_splat_extract_undef:
64; CHECK:       // %bb.0:
65; CHECK-NEXT:    fneg v0.4s, v0.4s
66; CHECK-NEXT:    dup v0.2s, v0.s[3]
67; CHECK-NEXT:    ret
68  %rhs_neg = fsub <4 x float> <float undef, float -0.0, float -0.0, float -0.0>, %rhs
69  %splat = shufflevector <4 x float> %rhs_neg, <4 x float> undef, <2 x i32> <i32 3, i32 3>
70  ret <2 x float> %splat
71}
72
73attributes #0 = { "no-signed-zeros-fp-math"="true" }
74