Skip to content

Commit

Permalink
[AArch64] Correct the regtype of indexed fmlal
Browse files Browse the repository at this point in the history
The indexed fmlal should use a low numbered register for the index operand,
which this fixes by making it V128_lo.

Fixes 64104

Differential Revision: https://reviews.llvm.org/D156296
  • Loading branch information
davemgreen committed Jul 27, 2023
1 parent e012c5c commit 509cb33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/AArch64/AArch64InstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -8440,12 +8440,12 @@ class BaseSIMDThreeSameVectorFMLIndex<bit Q, bit U, bits<4> opc, string asm,
string rhs_kind, RegisterOperand RegType,
ValueType AccumType, ValueType InputType,
SDPatternOperator OpNode> :
BaseSIMDIndexedTied<Q, U, 0, 0b10, opc, RegType, RegType, V128,
BaseSIMDIndexedTied<Q, U, 0, 0b10, opc, RegType, RegType, V128_lo,
VectorIndexH, asm, "", dst_kind, lhs_kind, rhs_kind,
[(set (AccumType RegType:$dst),
(AccumType (OpNode (AccumType RegType:$Rd),
(InputType RegType:$Rn),
(InputType (AArch64duplane16 (v8f16 V128:$Rm),
(InputType (AArch64duplane16 (v8f16 V128_lo:$Rm),
VectorIndexH:$idx)))))]> {
// idx = H:L:M
bits<3> idx;
Expand Down
12 changes: 8 additions & 4 deletions llvm/test/CodeGen/AArch64/fmlal-loreg.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@
define <4 x float> @test(ptr %lhs_panel, ptr %rhs_panel, <4 x float> %a) {
; CHECK-LABEL: test:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: str d8, [sp, #-16]! // 8-byte Folded Spill
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: .cfi_offset b8, -16
; CHECK-NEXT: fmov x8, d0
; CHECK-NEXT: ldr q16, [x0]
; CHECK-NEXT: ldr q17, [x1]
; CHECK-NEXT: ldr q8, [x0]
; CHECK-NEXT: ldr q16, [x1]
; CHECK-NEXT: lsr x9, x8, #32
; CHECK-NEXT: //APP
; CHECK-NEXT: nop
; CHECK-NEXT: //NO_APP
; CHECK-NEXT: mov w8, w8
; CHECK-NEXT: orr x8, x8, x9, lsl #32
; CHECK-NEXT: fmov d0, x8
; CHECK-NEXT: fmlal v0.4s, v17.4h, v16.h[0]
; CHECK-NEXT: fmlal v0.4s, v16.4h, v8.h[0]
; CHECK-NEXT: mov v1.16b, v0.16b
; CHECK-NEXT: fmlal2 v1.4s, v17.4h, v16.h[0]
; CHECK-NEXT: fmlal2 v1.4s, v16.4h, v8.h[0]
; CHECK-NEXT: fadd v0.4s, v0.4s, v1.4s
; CHECK-NEXT: ldr d8, [sp], #16 // 8-byte Folded Reload
; CHECK-NEXT: ret
entry:
%0 = load <8 x half>, ptr %lhs_panel, align 2
Expand Down

0 comments on commit 509cb33

Please sign in to comment.