1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
# RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve -run-pass=peephole-opt -verify-machineinstrs %s -o - | FileCheck %s
# Test that RDFFR followed by PTEST is replaced with RDFFRS.
---
# CHECK-LABEL: name:{{\s*}} substitute_rdffr_pp_with_rdffrs_pp
name: substitute_rdffr_pp_with_rdffrs_pp
tracksRegLiveness: true
body: |
bb.0:
liveins: $ffr, $p0
%0:ppr_3b = COPY $p0
; CHECK: RDFFRS_PPz
; CHECK-NOT: PTEST
%1:ppr_3b = RDFFR_PPz %0:ppr_3b
PTEST_PP killed %0:ppr_3b, killed %1:ppr_3b, implicit-def $nzcv
; Consume nzcv
%2:gpr32 = COPY $wzr
%3:gpr32 = CSINCWr killed %2, $wzr, 0, implicit $nzcv
$w0 = COPY %3
RET_ReallyLR implicit $w0
...
---
# CHECK-LABEL: name:{{\s*}} fail_to_substitute_rdffr_pp_with_rdffrs_pp_differing_mask
name: fail_to_substitute_rdffr_pp_with_rdffrs_pp_differing_mask
tracksRegLiveness: true
body: |
bb.0:
liveins: $ffr, $p0, $p1
%0:ppr_3b = COPY $p0
%1:ppr_3b = COPY $p1
; CHECK: RDFFR_PPz
; CHECK: PTEST
%2:ppr_3b = RDFFR_PPz %0:ppr_3b
PTEST_PP killed %1:ppr_3b, killed %2:ppr_3b, implicit-def $nzcv
; Consume nzcv
%3:gpr32 = COPY $wzr
%4:gpr32 = CSINCWr killed %3, $wzr, 0, implicit $nzcv
$w0 = COPY %4
RET_ReallyLR implicit $w0
...
---
# CHECK-LABEL: name:{{\s*}} fail_to_substitute_rdffr_pp_with_rdffrs_pp_nzcv_clobbered
name: fail_to_substitute_rdffr_pp_with_rdffrs_pp_nzcv_clobbered
tracksRegLiveness: true
body: |
bb.0:
liveins: $ffr, $p0, $x0
%0:ppr_3b = COPY $p0
; CHECK: RDFFR_PPz
; CHECK-NEXT: ADDSXrr
; CHECK-NEXT: PTEST_PP
%1:ppr_3b = RDFFR_PPz %0:ppr_3b
; Clobber nzcv
$x0 = ADDSXrr $x0, $x0, implicit-def $nzcv
PTEST_PP killed %0:ppr_3b, killed %1:ppr_3b, implicit-def $nzcv
; Consume nzcv
%2:gpr32 = COPY $wzr
%3:gpr32 = CSINCWr killed %2, $wzr, 0, implicit $nzcv
$w0 = COPY %3
RET_ReallyLR implicit $w0
...
---
# CHECK-LABEL: name:{{\s*}} fail_to_substitute_rdffr_pp_with_rdffrs_pp_nzcv_flags_used_between
name: fail_to_substitute_rdffr_pp_with_rdffrs_pp_nzcv_flags_used_between
tracksRegLiveness: true
body: |
bb.0:
liveins: $ffr, $p0, $x0
%0:ppr_3b = COPY $p0
$wzr = SUBSWri $w0, 0, 0, implicit-def $nzcv
; CHECK: RDFFR_PPz
; CHECK-NEXT: CSINCWr
; CHECK-NEXT: PTEST_PP
%1:ppr_3b = RDFFR_PPz %0:ppr_3b
; Consume nzcv
%2:gpr32 = CSINCWr $wzr, $wzr, 0, implicit $nzcv
PTEST_PP killed %0:ppr_3b, killed %1:ppr_3b, implicit-def $nzcv
; Consume nzcv
%3:gpr32 = COPY $wzr
%4:gpr32 = CSINCWr killed %3, $wzr, 0, implicit $nzcv
$w0 = ORRWrs %4, %2, 1
RET_ReallyLR implicit $w0
|