1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve < %s | FileCheck %s
4 ; Fold fadda(ptrue, x, select(mask, y, -0.0)) -> fadda(mask, x, y)
6 define float @pred_fadda_nxv2f32(float %x, <vscale x 2 x float> %y, <vscale x 2 x i1> %mask) {
7 ; CHECK-LABEL: pred_fadda_nxv2f32:
9 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
10 ; CHECK-NEXT: fadda s0, p0, s0, z1.s
11 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
13 %i = insertelement <vscale x 2 x float> poison, float -0.000000e+00, i32 0
14 %minus0 = shufflevector <vscale x 2 x float> %i, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
15 %sel = select <vscale x 2 x i1> %mask, <vscale x 2 x float> %y, <vscale x 2 x float> %minus0
16 %fadda = call float @llvm.vector.reduce.fadd.nxv2f32(float %x, <vscale x 2 x float> %sel)
20 define float @pred_fadda_nxv4f32(float %x, <vscale x 4 x float> %y, <vscale x 4 x i1> %mask) {
21 ; CHECK-LABEL: pred_fadda_nxv4f32:
23 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $z0
24 ; CHECK-NEXT: fadda s0, p0, s0, z1.s
25 ; CHECK-NEXT: // kill: def $s0 killed $s0 killed $z0
27 %i = insertelement <vscale x 4 x float> poison, float -0.000000e+00, i32 0
28 %minus0 = shufflevector <vscale x 4 x float> %i, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
29 %sel = select <vscale x 4 x i1> %mask, <vscale x 4 x float> %y, <vscale x 4 x float> %minus0
30 %fadda = call float @llvm.vector.reduce.fadd.nxv4f32(float %x, <vscale x 4 x float> %sel)
34 define double @pred_fadda_nxv2f64(double %x, <vscale x 2 x double> %y, <vscale x 2 x i1> %mask) {
35 ; CHECK-LABEL: pred_fadda_nxv2f64:
37 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
38 ; CHECK-NEXT: fadda d0, p0, d0, z1.d
39 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
41 %i = insertelement <vscale x 2 x double> poison, double -0.000000e+00, i32 0
42 %minus0 = shufflevector <vscale x 2 x double> %i, <vscale x 2 x double> poison, <vscale x 2 x i32> zeroinitializer
43 %sel = select <vscale x 2 x i1> %mask, <vscale x 2 x double> %y, <vscale x 2 x double> %minus0
44 %fadda = call double @llvm.vector.reduce.fadd.nxv2f64(double %x, <vscale x 2 x double> %sel)
48 define half @pred_fadda_nxv2f16(half %x, <vscale x 2 x half> %y, <vscale x 2 x i1> %mask) {
49 ; CHECK-LABEL: pred_fadda_nxv2f16:
51 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
52 ; CHECK-NEXT: fadda h0, p0, h0, z1.h
53 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
55 %i = insertelement <vscale x 2 x half> poison, half -0.000000e+00, i32 0
56 %minus0 = shufflevector <vscale x 2 x half> %i, <vscale x 2 x half> poison, <vscale x 2 x i32> zeroinitializer
57 %sel = select <vscale x 2 x i1> %mask, <vscale x 2 x half> %y, <vscale x 2 x half> %minus0
58 %fadda = call half @llvm.vector.reduce.fadd.nxv2f16(half %x, <vscale x 2 x half> %sel)
62 define half @pred_fadda_nxv4f16(half %x, <vscale x 4 x half> %y, <vscale x 4 x i1> %mask) {
63 ; CHECK-LABEL: pred_fadda_nxv4f16:
65 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
66 ; CHECK-NEXT: fadda h0, p0, h0, z1.h
67 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
69 %i = insertelement <vscale x 4 x half> poison, half -0.000000e+00, i32 0
70 %minus0 = shufflevector <vscale x 4 x half> %i, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
71 %sel = select <vscale x 4 x i1> %mask, <vscale x 4 x half> %y, <vscale x 4 x half> %minus0
72 %fadda = call half @llvm.vector.reduce.fadd.nxv4f16(half %x, <vscale x 4 x half> %sel)
76 define half @pred_fadda_nxv8f16(half %x, <vscale x 8 x half> %y, <vscale x 8 x i1> %mask) {
77 ; CHECK-LABEL: pred_fadda_nxv8f16:
79 ; CHECK-NEXT: // kill: def $h0 killed $h0 def $z0
80 ; CHECK-NEXT: fadda h0, p0, h0, z1.h
81 ; CHECK-NEXT: // kill: def $h0 killed $h0 killed $z0
83 %i = insertelement <vscale x 8 x half> poison, half -0.000000e+00, i32 0
84 %minus0 = shufflevector <vscale x 8 x half> %i, <vscale x 8 x half> poison, <vscale x 8 x i32> zeroinitializer
85 %sel = select <vscale x 8 x i1> %mask, <vscale x 8 x half> %y, <vscale x 8 x half> %minus0
86 %fadda = call half @llvm.vector.reduce.fadd.nxv8f16(half %x, <vscale x 8 x half> %sel)
90 declare float @llvm.vector.reduce.fadd.nxv2f32(float, <vscale x 2 x float>)
91 declare float @llvm.vector.reduce.fadd.nxv4f32(float, <vscale x 4 x float>)
92 declare double @llvm.vector.reduce.fadd.nxv2f64(double, <vscale x 2 x double>)
93 declare half @llvm.vector.reduce.fadd.nxv2f16(half, <vscale x 2 x half>)
94 declare half @llvm.vector.reduce.fadd.nxv4f16(half, <vscale x 4 x half>)
95 declare half @llvm.vector.reduce.fadd.nxv8f16(half, <vscale x 8 x half>)