This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Combine add(extract v1i64) into v1i64 add
ClosedPublic

Authored by dmgreen on Apr 14 2023, 1:39 AM.

Details

Summary

This helps fix a regression from D148309 where a shift + add was no longer combined into a ssra. It looks for add's with v1i64 extract operands and converts them to v1i64 adds. The other operand needs to be something that is easily converted to a v1i64, in this case it currently just checks for a load.

Diff Detail

Event Timeline

dmgreen created this revision.Apr 14 2023, 1:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 1:39 AM
dmgreen requested review of this revision.Apr 14 2023, 1:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 1:39 AM
bipmis accepted this revision.Apr 18 2023, 2:55 AM

LGTM. May benefit from an additional back to back add/sub nodes based tests and extracts out of a non <1 x i64> type

define i64 @sub_i64_ext_ext_test1(<1 x i64> %A, <2 x i64> %B) nounwind {
; CHECK-LABEL: sub_i64_ext_ext_test1:
; CHECK: %bb.0:
; CHECK-NEXT:
kill: def $d0 killed $d0 def $q0
; CHECK-NEXT: mov x8, v1.d[1]
; CHECK-NEXT: fmov x9, d0
; CHECK-NEXT: fmov x10, d1
; CHECK-NEXT: sub x9, x9, x10
; CHECK-NEXT: sub x0, x9, x8
; CHECK-NEXT: ret

%a = extractelement <1 x i64> %A, i32 0
%b = extractelement <2 x i64> %B, i32 0
%c = extractelement <2 x i64> %B, i32 1
%d = sub i64 %a, %b
%e = sub i64 %d, %c
ret i64 %e

}

This revision is now accepted and ready to land.Apr 18 2023, 2:55 AM
This revision was landed with ongoing or failed builds.May 16 2023, 10:30 AM
This revision was automatically updated to reflect the committed changes.