brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 4bd5c14 Raw
117 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple aarch64 -run-pass=aarch64-post-select-optimize -verify-machineinstrs %s -o - | FileCheck %s3--- |4  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"5 6  @x = external hidden local_unnamed_addr global ptr, align 87  define void @copy_from_larger_rc_def() { ret void }8  define void @copy_from_larger_rc_def_multi_use() { ret void }9  define void @copy_from_smaller_rc_def() { ret void }10 11...12---13name:            copy_from_larger_rc_def14alignment:       415legalized:       true16regBankSelected: true17selected:        true18tracksRegLiveness: true19liveins:20  - { reg: '$x0' }21  - { reg: '$w1' }22  - { reg: '$x2' }23body:             |24  bb.1:25    liveins: $w1, $x0, $x226 27    ; Show that if we're doing a copy from a large rc to a single user with a smaller rc28    ; then we just constrain the def instead.29    ; CHECK-LABEL: name: copy_from_larger_rc_def30    ; CHECK: liveins: $w1, $x0, $x231    ; CHECK-NEXT: {{  $}}32    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x033    ; CHECK-NEXT: %large_rc_def:gpr64common = UBFMXri [[COPY]], 61, 6034    ; CHECK-NEXT: %add:gpr64sp = ADDXri %large_rc_def, 3, 035    ; CHECK-NEXT: $x0 = COPY %add36    ; CHECK-NEXT: RET_ReallyLR37    %0:gpr64 = COPY $x038    %large_rc_def:gpr64 = UBFMXri %0, 61, 6039    %constrain_copy:gpr64common = COPY %large_rc_def40    ; Even though ADDXri may not actually need to use gpr64common, just use it as an example.41    %add:gpr64sp = ADDXri %constrain_copy, 3, 042    $x0 = COPY %add43    RET_ReallyLR44 45...46---47name:            copy_from_larger_rc_def_multi_use48alignment:       449legalized:       true50regBankSelected: true51selected:        true52tracksRegLiveness: true53liveins:54  - { reg: '$x0' }55  - { reg: '$w1' }56  - { reg: '$x2' }57body:             |58  bb.1:59    liveins: $w1, $x0, $x260 61    ; Don't constrain def if the original def has multiple users.62    ; CHECK-LABEL: name: copy_from_larger_rc_def_multi_use63    ; CHECK: liveins: $w1, $x0, $x264    ; CHECK-NEXT: {{  $}}65    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x066    ; CHECK-NEXT: %large_rc_def:gpr64 = UBFMXri [[COPY]], 61, 6067    ; CHECK-NEXT: %constrain_copy:gpr64common = COPY %large_rc_def68    ; CHECK-NEXT: %add:gpr64sp = ADDXri %constrain_copy, 3, 069    ; CHECK-NEXT: %add2:gpr64sp = ADDXri %constrain_copy, 3, 070    ; CHECK-NEXT: $x0 = COPY %add71    ; CHECK-NEXT: $x1 = COPY %large_rc_def72    ; CHECK-NEXT: RET_ReallyLR73    %0:gpr64 = COPY $x074    %large_rc_def:gpr64 = UBFMXri %0, 61, 6075    %constrain_copy:gpr64common = COPY %large_rc_def76    %add:gpr64sp = ADDXri %constrain_copy, 3, 077    %add2:gpr64sp = ADDXri %constrain_copy, 3, 078    $x0 = COPY %add79    $x1 = COPY %large_rc_def80    RET_ReallyLR81 82...83---84name:            copy_from_smaller_rc_def85alignment:       486legalized:       true87regBankSelected: true88selected:        true89tracksRegLiveness: true90liveins:91  - { reg: '$x0' }92  - { reg: '$w1' }93  - { reg: '$x2' }94body:             |95  bb.1:96    liveins: $w1, $x0, $x297 98    ; Show that if we're doing a copy from a small rc to a single user with a larger rc99    ; then we just use the smaller def instead of doing a copy.100    ; CHECK-LABEL: name: copy_from_smaller_rc_def101    ; CHECK: liveins: $w1, $x0, $x2102    ; CHECK-NEXT: {{  $}}103    ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64common = COPY $x0104    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64common = COPY $x1105    ; CHECK-NEXT: %add:gpr64common = ADDXri [[COPY1]], 3, 0106    ; CHECK-NEXT: STRXui [[COPY1]], %add, target-flags(aarch64-pageoff, aarch64-nc) @x :: (store (p0))107    ; CHECK-NEXT: RET_ReallyLR108    %0:gpr64common = COPY $x0109    %1:gpr64common = COPY $x1110 111    %add:gpr64common = ADDXri %1, 3, 0112    %copy:gpr64sp = COPY %add113    STRXui %1, %copy, target-flags(aarch64-pageoff, aarch64-nc) @x :: (store (p0))114    RET_ReallyLR115 116...117