|
2541 | 2541 | (unspec_volatile:SI [(match_operand:BLK 1 "memory_operand") ;; String1
|
2542 | 2542 | (match_operand:BLK 2 "memory_operand")] ;; String2
|
2543 | 2543 | UNSPEC_CMPSTRN))
|
2544 |
| - (use (match_operand:SI 3 "register_operand")) ;; Max Length |
| 2544 | + (use (match_operand:SI 3 "nonmemory_operand")) ;; Max Length |
2545 | 2545 | (match_operand:SI 4 "immediate_operand")] ;; Known Align
|
2546 | 2546 | "rx_allow_string_insns"
|
2547 | 2547 | {
|
| 2548 | + bool const_len = CONST_INT_P(operands[3]); |
| 2549 | + if (const_len) |
| 2550 | + { |
| 2551 | + if (INTVAL(operands[3]) == 0) |
| 2552 | + { |
| 2553 | + emit_move_insn (operands[0], GEN_INT(0)); |
| 2554 | + DONE; |
| 2555 | + } |
| 2556 | + } |
| 2557 | + |
2548 | 2558 | rtx str1 = gen_rtx_REG (SImode, 1);
|
2549 | 2559 | rtx str2 = gen_rtx_REG (SImode, 2);
|
2550 | 2560 | rtx len = gen_rtx_REG (SImode, 3);
|
|
2553 | 2563 | emit_move_insn (str2, force_operand (XEXP (operands[2], 0), NULL_RTX));
|
2554 | 2564 | emit_move_insn (len, operands[3]);
|
2555 | 2565 |
|
| 2566 | + /* Set flags in case len is zero */ |
| 2567 | + if (!const_len) { |
| 2568 | + emit_insn (gen_setpsw (GEN_INT('C'))); |
| 2569 | + emit_insn (gen_setpsw (GEN_INT('Z'))); |
| 2570 | + } |
2556 | 2571 | emit_insn (gen_rx_cmpstrn (operands[0], operands[1], operands[2]));
|
2557 | 2572 | DONE;
|
2558 | 2573 | }
|
|
2590 | 2605 | (clobber (reg:SI 3))
|
2591 | 2606 | (clobber (reg:CC CC_REG))]
|
2592 | 2607 | "rx_allow_string_insns"
|
2593 |
| - "setpsw z ; Set flags in case len is zero |
2594 |
| - setpsw c |
2595 |
| - scmpu ; Perform the string comparison |
| 2608 | + "scmpu ; Perform the string comparison |
2596 | 2609 | mov #-1, %0 ; Set up -1 result (which cannot be created
|
2597 | 2610 | ; by the SC insn)
|
2598 | 2611 | bnc ?+ ; If Carry is not set skip over
|
|
0 commit comments