|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2 |
| 2 | +; RUN: llc -mtriple=aarch64 -mattr=+fp16fml -verify-machineinstrs %s -o - 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +; This tests that the fmlal/fmlal2 instructions only accept lo registers for |
| 5 | +; the index operand, using inline asm to force the available registers. |
| 6 | + |
| 7 | +define <4 x float> @test(ptr %lhs_panel, ptr %rhs_panel, <4 x float> %a) { |
| 8 | +; CHECK-LABEL: test: |
| 9 | +; CHECK: // %bb.0: // %entry |
| 10 | +; CHECK-NEXT: fmov x8, d0 |
| 11 | +; CHECK-NEXT: ldr q16, [x0] |
| 12 | +; CHECK-NEXT: ldr q17, [x1] |
| 13 | +; CHECK-NEXT: lsr x9, x8, #32 |
| 14 | +; CHECK-NEXT: //APP |
| 15 | +; CHECK-NEXT: nop |
| 16 | +; CHECK-NEXT: //NO_APP |
| 17 | +; CHECK-NEXT: mov w8, w8 |
| 18 | +; CHECK-NEXT: orr x8, x8, x9, lsl #32 |
| 19 | +; CHECK-NEXT: fmov d0, x8 |
| 20 | +; CHECK-NEXT: fmlal v0.4s, v17.4h, v16.h[0] |
| 21 | +; CHECK-NEXT: mov v1.16b, v0.16b |
| 22 | +; CHECK-NEXT: fmlal2 v1.4s, v17.4h, v16.h[0] |
| 23 | +; CHECK-NEXT: fadd v0.4s, v0.4s, v1.4s |
| 24 | +; CHECK-NEXT: ret |
| 25 | +entry: |
| 26 | + %0 = load <8 x half>, ptr %lhs_panel, align 2 |
| 27 | + %1 = load <8 x half>, ptr %rhs_panel, align 2 |
| 28 | + %vecinit91 = shufflevector <8 x half> %0, <8 x half> undef, <8 x i32> zeroinitializer |
| 29 | + %b = call <4 x float> asm sideeffect "nop", "=r,r,~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7}"(<4 x float> %a) nounwind |
| 30 | + %vfmlal_low3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal.v4f32.v8f16(<4 x float> %b, <8 x half> %1, <8 x half> %vecinit91) |
| 31 | + %vfmlal_high3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal2.v4f32.v8f16(<4 x float> %vfmlal_low3.i, <8 x half> %1, <8 x half> %vecinit91) |
| 32 | + %z = fadd <4 x float> %vfmlal_low3.i, %vfmlal_high3.i |
| 33 | + ret <4 x float> %z |
| 34 | +} |
| 35 | + |
| 36 | +define void @loop(ptr %out_tile, ptr %lhs_panel, ptr %rhs_panel, i32 noundef %K, i32 noundef %flags) { |
| 37 | +; CHECK-LABEL: loop: |
| 38 | +; CHECK: // %bb.0: // %entry |
| 39 | +; CHECK-NEXT: movi v0.2d, #0000000000000000 |
| 40 | +; CHECK-NEXT: mov w8, w3 |
| 41 | +; CHECK-NEXT: movi v1.2d, #0000000000000000 |
| 42 | +; CHECK-NEXT: .LBB1_1: // %for.body |
| 43 | +; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 |
| 44 | +; CHECK-NEXT: ldr q2, [x1], #2 |
| 45 | +; CHECK-NEXT: ldr q3, [x2], #2 |
| 46 | +; CHECK-NEXT: subs x8, x8, #1 |
| 47 | +; CHECK-NEXT: fmlal v0.4s, v3.4h, v2.h[0] |
| 48 | +; CHECK-NEXT: fmlal2 v1.4s, v3.4h, v2.h[0] |
| 49 | +; CHECK-NEXT: b.ne .LBB1_1 |
| 50 | +; CHECK-NEXT: // %bb.2: // %for.cond.cleanup |
| 51 | +; CHECK-NEXT: stp q0, q1, [x0] |
| 52 | +; CHECK-NEXT: ret |
| 53 | +entry: |
| 54 | + %wide.trip.count = zext i32 %K to i64 |
| 55 | + br label %for.body |
| 56 | + |
| 57 | +for.cond.cleanup: ; preds = %for.body |
| 58 | + store <4 x float> %vfmlal_low3.i, ptr %out_tile, align 4 |
| 59 | + %add.ptr1399 = getelementptr inbounds float, ptr %out_tile, i64 4 |
| 60 | + store <4 x float> %vfmlal_high3.i, ptr %add.ptr1399, align 4 |
| 61 | + ret void |
| 62 | + |
| 63 | +for.body: ; preds = %entry, %for.body |
| 64 | + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 65 | + %acc0.01714 = phi <4 x float> [ zeroinitializer, %entry ], [ %vfmlal_low3.i, %for.body ] |
| 66 | + %acc1.01713 = phi <4 x float> [ zeroinitializer, %entry ], [ %vfmlal_high3.i, %for.body ] |
| 67 | + %add.ptr = getelementptr inbounds half, ptr %lhs_panel, i64 %indvars.iv |
| 68 | + %0 = load <8 x half>, ptr %add.ptr, align 2 |
| 69 | + %add.ptr19 = getelementptr inbounds half, ptr %rhs_panel, i64 %indvars.iv |
| 70 | + %1 = load <8 x half>, ptr %add.ptr19, align 2 |
| 71 | + %vecinit93 = shufflevector <8 x half> %0, <8 x half> undef, <8 x i32> zeroinitializer |
| 72 | + %vfmlal_low3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal.v4f32.v8f16(<4 x float> %acc0.01714, <8 x half> %1, <8 x half> %vecinit93) |
| 73 | + %vfmlal_high3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal2.v4f32.v8f16(<4 x float> %acc1.01713, <8 x half> %1, <8 x half> %vecinit93) |
| 74 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 75 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 76 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 77 | +} |
| 78 | + |
| 79 | +define void @sink(ptr %out_tile, ptr %lhs_panel, ptr %rhs_panel, i32 noundef %K, i32 noundef %flags, <8 x half> noundef %lhs) { |
| 80 | +; CHECK-LABEL: sink: |
| 81 | +; CHECK: // %bb.0: // %entry |
| 82 | +; CHECK-NEXT: movi v1.2d, #0000000000000000 |
| 83 | +; CHECK-NEXT: mov w8, w3 |
| 84 | +; CHECK-NEXT: movi v2.2d, #0000000000000000 |
| 85 | +; CHECK-NEXT: dup v0.8h, v0.h[0] |
| 86 | +; CHECK-NEXT: .LBB2_1: // %for.body |
| 87 | +; CHECK-NEXT: // =>This Inner Loop Header: Depth=1 |
| 88 | +; CHECK-NEXT: ldr q3, [x2], #2 |
| 89 | +; CHECK-NEXT: subs x8, x8, #1 |
| 90 | +; CHECK-NEXT: fmlal v1.4s, v3.4h, v0.4h |
| 91 | +; CHECK-NEXT: fmlal2 v2.4s, v3.4h, v0.4h |
| 92 | +; CHECK-NEXT: b.ne .LBB2_1 |
| 93 | +; CHECK-NEXT: // %bb.2: // %for.cond.cleanup |
| 94 | +; CHECK-NEXT: stp q1, q2, [x0] |
| 95 | +; CHECK-NEXT: ret |
| 96 | +entry: |
| 97 | + %vecinit89 = shufflevector <8 x half> %lhs, <8 x half> undef, <8 x i32> zeroinitializer |
| 98 | + %wide.trip.count = zext i32 %K to i64 |
| 99 | + br label %for.body |
| 100 | + |
| 101 | +for.cond.cleanup: ; preds = %for.body |
| 102 | + store <4 x float> %vfmlal_low3.i, ptr %out_tile, align 4 |
| 103 | + %add.ptr1395 = getelementptr inbounds float, ptr %out_tile, i64 4 |
| 104 | + store <4 x float> %vfmlal_high3.i, ptr %add.ptr1395, align 4 |
| 105 | + ret void |
| 106 | + |
| 107 | +for.body: ; preds = %entry, %for.body |
| 108 | + %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] |
| 109 | + %acc0.01702 = phi <4 x float> [ zeroinitializer, %entry ], [ %vfmlal_low3.i, %for.body ] |
| 110 | + %acc1.01701 = phi <4 x float> [ zeroinitializer, %entry ], [ %vfmlal_high3.i, %for.body ] |
| 111 | + %add.ptr = getelementptr inbounds half, ptr %rhs_panel, i64 %indvars.iv |
| 112 | + %0 = load <8 x half>, ptr %add.ptr, align 2 |
| 113 | + %vfmlal_low3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal.v4f32.v8f16(<4 x float> %acc0.01702, <8 x half> %0, <8 x half> %vecinit89) |
| 114 | + %vfmlal_high3.i = tail call <4 x float> @llvm.aarch64.neon.fmlal2.v4f32.v8f16(<4 x float> %acc1.01701, <8 x half> %0, <8 x half> %vecinit89) |
| 115 | + %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 |
| 116 | + %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count |
| 117 | + br i1 %exitcond.not, label %for.cond.cleanup, label %for.body |
| 118 | +} |
| 119 | + |
| 120 | + |
| 121 | +declare <4 x float> @llvm.aarch64.neon.fmlal.v4f32.v8f16(<4 x float>, <8 x half>, <8 x half>) #2 |
| 122 | +declare <4 x float> @llvm.aarch64.neon.fmlal2.v4f32.v8f16(<4 x float>, <8 x half>, <8 x half>) #2 |
| 123 | + |
0 commit comments