https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126299

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #2 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Created attachment 65100
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65100&action=edit
selfcontained executable reproducer for f1

This reproduces the wrong-code with 2.11BSD libc and the apout emulator.

As an experiment I excluded the multi-word modes from the mode iterators in
"cbranch<mode>4", so only QI and HI remained for the backend, and that fixed
this test case. The generated code for f1 went from the bogus

_f1:
        tst     02(sp)
        bne     L_3
        tst     04(sp)
L_3:
        bge     L_1
        mov     $01,_x
L_1:
        rts     pc

to the better-looking

_f1:
        tst     02(sp)
        bge     L_1
        mov     $01,_x
L_1:
        rts     pc

--- ./gcc/config/pdp11/pdp11.md.~1~     2026-07-19 00:32:07.000000000 +0200
+++ ./gcc/config/pdp11/pdp11.md 2026-07-20 14:37:09.743045489 +0200
@@ -437,8 +437,8 @@ (define_insn_and_split "cbranchdf4"
 (define_insn_and_split "cbranch<mode>4"
   [(set (pc)
        (if_then_else (match_operator 0 "ordered_comparison_operator"
-                      [(match_operand:QHSDint 1 "general_operand" "g")
-                       (match_operand:QHSDint 2 "general_operand" "g")])
+                      [(match_operand:PDPint 1 "general_operand" "g")
+                       (match_operand:PDPint 2 "general_operand" "g")])
                      (label_ref (match_operand 3 "" ""))
                      (pc)))]
   ""

Not tested beyond this test case.

Reply via email to