Commit ad44519
committed
rx: avoid adding setpsw for rx_cmpstrn when len is const
The only pattern for which the len may be zero is cmpstrsni. The other
pattern using rx_cmpstrn is cmpstrsi for which len is a constant -1,
so we'll be moving the setpsw instructions from rx_cmpstrn to
cmpstrnsi as follows:
1. Adjust the predicate on the length operand from "register_operand"
to "nonmemory_operand". This will allow constants to appear here,
instead of having them already transferred into a register.
2. Check to see if the len value is constant, and then check if it is
actually zero. In that case, short-circuit the rest of the pattern
and set the result register to 0.
3. Emit 'setpsw c' and 'setpsw z' instructions when the len is not a
constant, in case it turns out to be zero at runtime.
4. Remove the two 'setpsw' instructions from rx_cmpstrn.
Signed-off-by: Keith Packard <[email protected]>1 parent 64dece3 commit ad44519
1 file changed
+17
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2541 | 2541 | | |
2542 | 2542 | | |
2543 | 2543 | | |
2544 | | - | |
| 2544 | + | |
2545 | 2545 | | |
2546 | 2546 | | |
2547 | 2547 | | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
2548 | 2558 | | |
2549 | 2559 | | |
2550 | 2560 | | |
| |||
2553 | 2563 | | |
2554 | 2564 | | |
2555 | 2565 | | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
2556 | 2571 | | |
2557 | 2572 | | |
2558 | 2573 | | |
| |||
2590 | 2605 | | |
2591 | 2606 | | |
2592 | 2607 | | |
2593 | | - | |
2594 | | - | |
2595 | | - | |
| 2608 | + | |
2596 | 2609 | | |
2597 | 2610 | | |
2598 | 2611 | | |
| |||
0 commit comments