llvm-project/llvm/test/CodeGen/ARM/shouldRewriteCopySrc.ll
Matt Arsenault 9811226967
PeepholeOpt: Try to constrain uses to support subregister (#161338)
This allows removing a special case hack in ARM. ARM's implementation
of getExtractSubregLikeInputs has the strange property that it reports
a register with a class that does not support the reported subregister
index. We can however reconstrain the register to support this usage.

This is an alternative to #159600. I've included the test, but
the output is different. In this case version the VMOVSR is
replaced with an ordinary subregister extract copy.
2025-10-01 00:18:51 +09:00

29 lines
1.0 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=arm-none-eabihf -mcpu=cortex-a55 < %s | FileCheck %s
; Test that the override of shouldRewriteCopySrc does something
define float @shouldRewriteCopySrc(double %arg) #0 {
; CHECK-LABEL: shouldRewriteCopySrc:
; CHECK: @ %bb.0: @ %bb
; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: vadd.f64 d16, d0, d0
; CHECK-NEXT: @APP
; CHECK-NEXT: nop
; CHECK-NEXT: @NO_APP
; CHECK-NEXT: vmov.f64 d0, d16
; CHECK-NEXT: @ kill: def $s0 killed $s0 killed $d0
; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15}
; CHECK-NEXT: bx lr
bb:
%i = fadd double %arg, %arg
tail call void asm sideeffect "nop", "~{q0},~{q1},~{q2},~{q3},~{q4},~{q5},~{q6},~{q7}"() #0
%i1 = bitcast double %i to i64
%i2 = trunc i64 %i1 to i32
%i3 = bitcast i32 %i2 to float
ret float %i3
}
attributes #0 = { nounwind }