1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 -mattr=+sve %s -o - | FileCheck %s
4 define i64 @scalable_int_min_max(ptr %arg, ptr %arg1, <vscale x 2 x ptr> %i37, <vscale x 2 x i64> %i42, <vscale x 2 x i64> %i54) {
5 ; CHECK-LABEL: scalable_int_min_max:
6 ; CHECK: // %bb.0: // %entry
7 ; CHECK-NEXT: ptrue p0.d
8 ; CHECK-NEXT: mov w8, #3745 // =0xea1
9 ; CHECK-NEXT: movk w8, #16618, lsl #16
10 ; CHECK-NEXT: mov z4.s, w8
11 ; CHECK-NEXT: mov w8, #57344 // =0xe000
12 ; CHECK-NEXT: movk w8, #17535, lsl #16
13 ; CHECK-NEXT: mov z5.s, w8
14 ; CHECK-NEXT: ld1w { z3.d }, p0/z, [x0]
15 ; CHECK-NEXT: fmul z4.s, p0/m, z4.s, z3.s
16 ; CHECK-NEXT: fadd z4.s, p0/m, z4.s, z5.s
17 ; CHECK-NEXT: mov z5.d, #1023 // =0x3ff
18 ; CHECK-NEXT: fcvtzs z4.d, p0/m, z4.s
19 ; CHECK-NEXT: smax z4.d, z4.d, #0
20 ; CHECK-NEXT: smin z4.d, p0/m, z4.d, z5.d
21 ; CHECK-NEXT: cmpne p1.d, p0/z, z4.d, #0
22 ; CHECK-NEXT: ld1w { z4.d }, p1/z, [x1]
23 ; CHECK-NEXT: ld1w { z0.d }, p1/z, [z0.d]
24 ; CHECK-NEXT: fadd z0.s, p0/m, z0.s, z4.s
25 ; CHECK-NEXT: fcmge p2.s, p0/z, z0.s, z3.s
26 ; CHECK-NEXT: add z0.d, z2.d, z1.d
27 ; CHECK-NEXT: bic p2.b, p1/z, p1.b, p2.b
28 ; CHECK-NEXT: mov z0.d, p2/m, z2.d
29 ; CHECK-NEXT: sel z0.d, p1, z0.d, z2.d
30 ; CHECK-NEXT: uaddv d0, p0, z0.d
31 ; CHECK-NEXT: fmov x0, d0
34 %i56 = getelementptr inbounds float, ptr %arg, i64 0
35 %i57 = load <vscale x 2 x float>, ptr %i56, align 4
36 %i58 = fmul <vscale x 2 x float> %i57, shufflevector (<vscale x 2 x float> insertelement (<vscale x 2 x float> poison, float 0x401D41D420000000, i64 0), <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer)
37 %i59 = fadd <vscale x 2 x float> %i58, shufflevector (<vscale x 2 x float> insertelement (<vscale x 2 x float> poison, float 1.023500e+03, i64 0), <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer)
38 %i60 = fptosi <vscale x 2 x float> %i59 to <vscale x 2 x i32>
39 %i61 = tail call <vscale x 2 x i32> @llvm.smax.nxv2i32(<vscale x 2 x i32> %i60, <vscale x 2 x i32> zeroinitializer)
40 %i62 = tail call <vscale x 2 x i32> @llvm.smin.nxv2i32(<vscale x 2 x i32> %i61, <vscale x 2 x i32> shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 1023, i64 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer))
41 %i63 = icmp ne <vscale x 2 x i32> %i62, zeroinitializer
42 %i64 = getelementptr float, ptr %arg1, i64 0
43 %i65 = tail call <vscale x 2 x float> @llvm.masked.load.nxv2f32.p0(ptr %i64, i32 4, <vscale x 2 x i1> %i63, <vscale x 2 x float> poison)
44 %i66 = tail call <vscale x 2 x float> @llvm.masked.gather.nxv2f32.nxv2p0(<vscale x 2 x ptr> %i37, i32 4, <vscale x 2 x i1> %i63, <vscale x 2 x float> poison)
45 %i67 = fadd <vscale x 2 x float> %i65, %i66
46 %i68 = fcmp ult <vscale x 2 x float> %i67, %i57
47 %i74 = select <vscale x 2 x i1> %i63, <vscale x 2 x i1> %i68, <vscale x 2 x i1> zeroinitializer
48 %i75 = select <vscale x 2 x i1> %i74, <vscale x 2 x i64> zeroinitializer, <vscale x 2 x i64> %i42
49 %i76 = select <vscale x 2 x i1> %i63, <vscale x 2 x i64> %i75, <vscale x 2 x i64> zeroinitializer
50 %i77 = add <vscale x 2 x i64> %i54, %i76
51 %i116 = tail call i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64> %i77)
55 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
56 declare <vscale x 2 x i32> @llvm.smax.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i32>) #0
58 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
59 declare <vscale x 2 x i32> @llvm.smin.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i32>) #0
61 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: read)
62 declare <vscale x 2 x float> @llvm.masked.load.nxv2f32.p0(ptr nocapture, i32 immarg, <vscale x 2 x i1>, <vscale x 2 x float>) #1
64 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read)
65 declare <vscale x 2 x float> @llvm.masked.gather.nxv2f32.nxv2p0(<vscale x 2 x ptr>, i32 immarg, <vscale x 2 x i1>, <vscale x 2 x float>) #2
67 ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
68 declare i64 @llvm.vector.reduce.add.nxv2i64(<vscale x 2 x i64>) #3
70 attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
71 attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) }
72 attributes #2 = { nocallback nofree nosync nounwind willreturn memory(read) }
73 attributes #3 = { nocallback nofree nosync nounwind willreturn memory(none) }