diff --git a/gcc/gcc/config/riscv/peephole.md b/gcc/gcc/config/riscv/peephole.md index 83293bb0..95dd0a24 100644 --- a/gcc/gcc/config/riscv/peephole.md +++ b/gcc/gcc/config/riscv/peephole.md @@ -43,37 +43,7 @@ (match_op_dup:SI 4 [(match_dup 1) (match_dup 2)]))]) ;; Simplify PIC loads to static variables. -(define_peephole2 - [(set (match_operand:P 0 "register_operand") - (match_operand:P 1 "absolute_symbolic_operand")) - (set (match_operand:ANYI 2 "register_operand") - (mem:ANYI (match_dup 0)))] - "(flag_pic && SYMBOL_REF_LOCAL_P (operands[1])) && (REGNO (operands[0]) == REGNO (operands[2]) || peep2_reg_dead_p (2, operands[0]))" - [(set (match_dup 2) (mem:ANYI (match_dup 1)))]) -(define_peephole2 - [(set (match_operand:P 0 "register_operand") - (match_operand:P 1 "absolute_symbolic_operand")) - (set (match_operand:ANYF 2 "register_operand") - (mem:ANYF (match_dup 0)))] - "(flag_pic && SYMBOL_REF_LOCAL_P (operands[1])) && peep2_reg_dead_p (2, operands[0])" - [(set (match_dup 2) (mem:ANYF (match_dup 1))) - (clobber (match_dup 0))]) -(define_peephole2 - [(set (match_operand:DI 0 "register_operand") - (match_operand:DI 1 "absolute_symbolic_operand")) - (set (mem:ANYIF (match_dup 0)) - (match_operand:ANYIF 2 "reg_or_0_operand"))] - "TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[1])) && peep2_reg_dead_p (2, operands[0])" - [(set (mem:ANYIF (match_dup 1)) (match_dup 2)) - (clobber (match_dup 0))]) -(define_peephole2 - [(set (match_operand:SI 0 "register_operand") - (match_operand:SI 1 "absolute_symbolic_operand")) - (set (mem:ANYIF (match_dup 0)) - (match_operand:ANYIF 2 "register_operand"))] - "!TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[1])) && peep2_reg_dead_p (2, operands[0])" - [(set (mem:ANYIF (match_dup 1)) (match_dup 2)) - (clobber (match_dup 0))]) +;; These will go away once we figure out how to emit auipc discretely. (define_insn "*local_pic_load" [(set (match_operand:ANYI 0 "register_operand" "=r") (mem:ANYI (match_operand 1 "absolute_symbolic_operand" "")))] @@ -84,7 +54,14 @@ [(set (match_operand:ANYF 0 "register_operand" "=f") (mem:ANYF (match_operand 1 "absolute_symbolic_operand" ""))) (clobber (match_scratch:DI 2 "=&r"))] - "flag_pic && SYMBOL_REF_LOCAL_P (operands[1])" + "TARGET_HARD_FLOAT && TARGET_64BIT && flag_pic && SYMBOL_REF_LOCAL_P (operands[1])" + "\t%0,%1,%2" + [(set (attr "length") (const_int 8))]) +(define_insn "*local_pic_load" + [(set (match_operand:ANYF 0 "register_operand" "=f") + (mem:ANYF (match_operand 1 "absolute_symbolic_operand" ""))) + (clobber (match_scratch:SI 2 "=&r"))] + "TARGET_HARD_FLOAT && !TARGET_64BIT && flag_pic && SYMBOL_REF_LOCAL_P (operands[1])" "\t%0,%1,%2" [(set (attr "length") (const_int 8))]) (define_insn "*local_pic_loadu" @@ -111,13 +88,13 @@ [(set (mem:ANYF (match_operand 0 "absolute_symbolic_operand" "")) (match_operand:ANYF 1 "register_operand" "f")) (clobber (match_scratch:DI 2 "=&r"))] - "TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))" + "TARGET_HARD_FLOAT && TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))" "\t%1,%0,%2" [(set (attr "length") (const_int 8))]) (define_insn "*local_pic_storesi" [(set (mem:ANYF (match_operand 0 "absolute_symbolic_operand" "")) (match_operand:ANYF 1 "register_operand" "f")) (clobber (match_scratch:SI 2 "=&r"))] - "!TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))" + "TARGET_HARD_FLOAT && !TARGET_64BIT && (flag_pic && SYMBOL_REF_LOCAL_P (operands[0]))" "\t%1,%0,%2" [(set (attr "length") (const_int 8))])