From 5406e08aa9ff7471dc3f7c3edff7fbb9d6bdac19 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Fri, 28 Apr 1995 02:04:32 +0000 Subject: [PATCH] sparc.md (tablejump): Only if ! TARGET_MEDANY. * sparc/sparc.md (tablejump): Only if ! TARGET_MEDANY. (casesi): New pattern for TARGET_MEDANY case. From-SVN: r9527 --- gcc/config/sparc/sparc.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index b24c0fa744d..c69d400e083 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -4674,7 +4674,7 @@ (define_expand "tablejump" [(parallel [(set (pc) (match_operand 0 "register_operand" "r")) (use (label_ref (match_operand 1 "" "")))])] - "" + "! TARGET_MEDANY" " { if (GET_MODE (operands[0]) != Pmode) @@ -4736,6 +4736,40 @@ "call %l0%#" [(set_attr "type" "uncond_branch")]) +;; Implement a switch statement for the medium/anywhere code model. +;; This wouldn't be necessary if we could distinguish label refs of the jump +;; table from other label refs. The problem is that jump tables live in the +;; .rodata section and thus we need to add %g4 to get their address. + +(define_expand "casesi" + [(set (match_dup 5) + (minus:SI (match_operand:SI 0 "register_operand" "") + (match_operand:SI 1 "nonmemory_operand" ""))) + (set (reg:CC 0) + (compare:CC (match_dup 5) + (match_operand:SI 2 "nonmemory_operand" ""))) + (set (pc) + (if_then_else (gtu (reg:CC 0) + (const_int 0)) + (label_ref (match_operand 4 "" "")) + (pc))) + (parallel [(set (match_dup 6) (high:DI (label_ref (match_operand 3 "" "")))) + (clobber (reg:DI 1))]) + (set (match_dup 6) + (lo_sum:DI (match_dup 6) (label_ref (match_dup 3)))) + (set (match_dup 6) (plus:DI (match_dup 6) (reg:DI 4))) + (set (match_dup 7) (zero_extend:DI (match_dup 5))) + (set (match_dup 7) (ashift:DI (match_dup 7) (const_int 3))) + (set (match_dup 7) (mem:DI (plus:DI (match_dup 6) (match_dup 7)))) + (set (pc) (match_dup 7))] + "TARGET_MEDANY" + " +{ + operands[5] = gen_reg_rtx (SImode); + operands[6] = gen_reg_rtx (DImode); + operands[7] = gen_reg_rtx (DImode); +}") + ;; This pattern recognizes the "instruction" that appears in ;; a function call that wants a structure value, ;; to inform the called function if compiled with Sun CC. -- 2.30.2