Skip to content

Commit 72b28f6

Browse files
keith-packardnashif
authored andcommitted
[PATCH] rx: allow cmpstrnsi len to be zero
The SCMPU instruction doesn't change the C and Z flags when the incoming length is zero, which means the insn will produce a value based upon the existing flag values. As a quick kludge, adjust these flags to ensure a zero result in this case. gcc/ * config/rx/rx.md (rx_cmpstrn): Correctly handle len=0 case.
1 parent 9bd0f11 commit 72b28f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gcc/config/rx/rx.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2590,7 +2590,9 @@
25902590
(clobber (reg:SI 3))
25912591
(clobber (reg:CC CC_REG))]
25922592
"rx_allow_string_insns"
2593-
"scmpu ; Perform the string comparison
2593+
"setpsw z ; Set flags in case len is zero
2594+
setpsw c
2595+
scmpu ; Perform the string comparison
25942596
mov #-1, %0 ; Set up -1 result (which cannot be created
25952597
; by the SC insn)
25962598
bnc ?+ ; If Carry is not set skip over

0 commit comments

Comments
 (0)