comparison gcc/config/rs6000/predicates.md @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents 77e2b8dfacca
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 ;; Predicate definitions for POWER and PowerPC. 1 ;; Predicate definitions for POWER and PowerPC.
2 ;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 2 ;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
3 ;; Free Software Foundation, Inc.
3 ;; 4 ;;
4 ;; This file is part of GCC. 5 ;; This file is part of GCC.
5 ;; 6 ;;
6 ;; GCC is free software; you can redistribute it and/or modify 7 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by 8 ;; it under the terms of the GNU General Public License as published by
67 (and (match_operand 0 "register_operand") 68 (and (match_operand 0 "register_operand")
68 (match_test "GET_CODE (op) != REG 69 (match_test "GET_CODE (op) != REG
69 || VLOGICAL_REGNO_P (REGNO (op)) 70 || VLOGICAL_REGNO_P (REGNO (op))
70 || REGNO (op) > LAST_VIRTUAL_REGISTER"))) 71 || REGNO (op) > LAST_VIRTUAL_REGISTER")))
71 72
72 ;; Return 1 if op is XER register. 73 ;; Return 1 if op is the carry register.
73 (define_predicate "xer_operand" 74 (define_predicate "ca_operand"
74 (and (match_code "reg") 75 (and (match_code "reg")
75 (match_test "XER_REGNO_P (REGNO (op))"))) 76 (match_test "CA_REGNO_P (REGNO (op))")))
76 77
77 ;; Return 1 if op is a signed 5-bit constant integer. 78 ;; Return 1 if op is a signed 5-bit constant integer.
78 (define_predicate "s5bit_cint_operand" 79 (define_predicate "s5bit_cint_operand"
79 (and (match_code "const_int") 80 (and (match_code "const_int")
80 (match_test "INTVAL (op) >= -16 && INTVAL (op) <= 15"))) 81 (match_test "INTVAL (op) >= -16 && INTVAL (op) <= 15")))
114 ;; Return 1 if op is a register that is not special. 115 ;; Return 1 if op is a register that is not special.
115 (define_predicate "gpc_reg_operand" 116 (define_predicate "gpc_reg_operand"
116 (and (match_operand 0 "register_operand") 117 (and (match_operand 0 "register_operand")
117 (match_test "(GET_CODE (op) != REG 118 (match_test "(GET_CODE (op) != REG
118 || (REGNO (op) >= ARG_POINTER_REGNUM 119 || (REGNO (op) >= ARG_POINTER_REGNUM
119 && !XER_REGNO_P (REGNO (op))) 120 && !CA_REGNO_P (REGNO (op)))
120 || REGNO (op) < MQ_REGNO) 121 || REGNO (op) < MQ_REGNO)
121 && !((TARGET_E500_DOUBLE || TARGET_SPE) 122 && !((TARGET_E500_DOUBLE || TARGET_SPE)
122 && invalid_e500_subreg (op, mode))"))) 123 && invalid_e500_subreg (op, mode))")))
123 124
124 ;; Return 1 if op is a register that is a condition register field. 125 ;; Return 1 if op is a register that is a condition register field.
325 /* As the paired vectors are actually FPRs it seems that there is 326 /* As the paired vectors are actually FPRs it seems that there is
326 no easy way to load a CONST_VECTOR without using memory. */ 327 no easy way to load a CONST_VECTOR without using memory. */
327 if (TARGET_PAIRED_FLOAT) 328 if (TARGET_PAIRED_FLOAT)
328 return false; 329 return false;
329 330
330 if ((VSX_VECTOR_MODE (mode) || mode == TImode) && zero_constant (op, mode)) 331 if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
331 return true;
332
333 if (ALTIVEC_VECTOR_MODE (mode))
334 { 332 {
335 if (zero_constant (op, mode)) 333 if (zero_constant (op, mode))
336 return true; 334 return true;
335
337 return easy_altivec_constant (op, mode); 336 return easy_altivec_constant (op, mode);
338 } 337 }
339 338
340 if (SPE_VECTOR_MODE (mode)) 339 if (SPE_VECTOR_MODE (mode))
341 { 340 {
370 (define_predicate "easy_vector_constant_add_self" 369 (define_predicate "easy_vector_constant_add_self"
371 (and (match_code "const_vector") 370 (and (match_code "const_vector")
372 (and (match_test "TARGET_ALTIVEC") 371 (and (match_test "TARGET_ALTIVEC")
373 (match_test "easy_altivec_constant (op, mode)"))) 372 (match_test "easy_altivec_constant (op, mode)")))
374 { 373 {
375 HOST_WIDE_INT val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1); 374 HOST_WIDE_INT val;
375 if (mode == V2DImode || mode == V2DFmode)
376 return 0;
377 val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1);
376 val = ((val & 0xff) ^ 0x80) - 0x80; 378 val = ((val & 0xff) ^ 0x80) - 0x80;
377 return EASY_VECTOR_15_ADD_SELF (val); 379 return EASY_VECTOR_15_ADD_SELF (val);
378 }) 380 })
379 381
380 ;; Same as easy_vector_constant but only for EASY_VECTOR_MSB. 382 ;; Same as easy_vector_constant but only for EASY_VECTOR_MSB.
381 (define_predicate "easy_vector_constant_msb" 383 (define_predicate "easy_vector_constant_msb"
382 (and (match_code "const_vector") 384 (and (match_code "const_vector")
383 (and (match_test "TARGET_ALTIVEC") 385 (and (match_test "TARGET_ALTIVEC")
384 (match_test "easy_altivec_constant (op, mode)"))) 386 (match_test "easy_altivec_constant (op, mode)")))
385 { 387 {
386 HOST_WIDE_INT val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1); 388 HOST_WIDE_INT val;
389 if (mode == V2DImode || mode == V2DFmode)
390 return 0;
391 val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1);
387 return EASY_VECTOR_MSB (val, GET_MODE_INNER (mode)); 392 return EASY_VECTOR_MSB (val, GET_MODE_INNER (mode));
388 }) 393 })
389 394
390 ;; Return 1 if operand is constant zero (scalars and vectors). 395 ;; Return 1 if operand is constant zero (scalars and vectors).
391 (define_predicate "zero_constant" 396 (define_predicate "zero_constant"
733 ;; pre_inc or pre_dec or pre_modify, which produces invalid form of PowerPC 738 ;; pre_inc or pre_dec or pre_modify, which produces invalid form of PowerPC
734 ;; lwa instruction. 739 ;; lwa instruction.
735 (define_predicate "lwa_operand" 740 (define_predicate "lwa_operand"
736 (match_code "reg,subreg,mem") 741 (match_code "reg,subreg,mem")
737 { 742 {
738 rtx inner = op; 743 rtx inner, addr, offset;
739 744
745 inner = op;
740 if (reload_completed && GET_CODE (inner) == SUBREG) 746 if (reload_completed && GET_CODE (inner) == SUBREG)
741 inner = SUBREG_REG (inner); 747 inner = SUBREG_REG (inner);
742 748
743 return gpc_reg_operand (inner, mode) 749 if (gpc_reg_operand (inner, mode))
744 || (memory_operand (inner, mode) 750 return true;
745 && GET_CODE (XEXP (inner, 0)) != PRE_INC 751 if (!memory_operand (inner, mode))
746 && GET_CODE (XEXP (inner, 0)) != PRE_DEC 752 return false;
747 && (GET_CODE (XEXP (inner, 0)) != PRE_MODIFY 753 addr = XEXP (inner, 0);
748 || legitimate_indexed_address_p (XEXP (XEXP (inner, 0), 1), 0)) 754 if (GET_CODE (addr) == PRE_INC
749 && (GET_CODE (XEXP (inner, 0)) != PLUS 755 || GET_CODE (addr) == PRE_DEC
750 || GET_CODE (XEXP (XEXP (inner, 0), 1)) != CONST_INT 756 || (GET_CODE (addr) == PRE_MODIFY
751 || INTVAL (XEXP (XEXP (inner, 0), 1)) % 4 == 0)); 757 && !legitimate_indexed_address_p (XEXP (addr, 1), 0)))
758 return false;
759 if (GET_CODE (addr) == LO_SUM
760 && GET_CODE (XEXP (addr, 0)) == REG
761 && GET_CODE (XEXP (addr, 1)) == CONST)
762 addr = XEXP (XEXP (addr, 1), 0);
763 if (GET_CODE (addr) != PLUS)
764 return true;
765 offset = XEXP (addr, 1);
766 if (GET_CODE (offset) != CONST_INT)
767 return true;
768 return INTVAL (offset) % 4 == 0;
752 }) 769 })
753 770
754 ;; Return 1 if the operand, used inside a MEM, is a SYMBOL_REF. 771 ;; Return 1 if the operand, used inside a MEM, is a SYMBOL_REF.
755 (define_predicate "symbol_ref_operand" 772 (define_predicate "symbol_ref_operand"
756 (and (match_code "symbol_ref") 773 (and (match_code "symbol_ref")
835 register. */ 852 register. */
836 if (register_operand (op, mode)) 853 if (register_operand (op, mode))
837 return 1; 854 return 1;
838 855
839 /* A SYMBOL_REF referring to the TOC is valid. */ 856 /* A SYMBOL_REF referring to the TOC is valid. */
840 if (legitimate_constant_pool_address_p (op)) 857 if (legitimate_constant_pool_address_p (op, mode, false))
841 return 1; 858 return 1;
842 859
843 /* A constant pool expression (relative to the TOC) is valid */ 860 /* A constant pool expression (relative to the TOC) is valid */
844 if (toc_relative_expr_p (op)) 861 if (toc_relative_expr_p (op))
845 return 1; 862 return 1;
900 ;; Return 1 if OP is a comparison operation that is valid for an SCC insn -- 917 ;; Return 1 if OP is a comparison operation that is valid for an SCC insn --
901 ;; it must be a positive comparison. 918 ;; it must be a positive comparison.
902 (define_predicate "scc_comparison_operator" 919 (define_predicate "scc_comparison_operator"
903 (and (match_operand 0 "branch_comparison_operator") 920 (and (match_operand 0 "branch_comparison_operator")
904 (match_code "eq,lt,gt,ltu,gtu,unordered"))) 921 (match_code "eq,lt,gt,ltu,gtu,unordered")))
922
923 ;; Return 1 if OP is a comparison operation whose inverse would be valid for
924 ;; an SCC insn.
925 (define_predicate "scc_rev_comparison_operator"
926 (and (match_operand 0 "branch_comparison_operator")
927 (match_code "ne,le,ge,leu,geu,ordered")))
905 928
906 ;; Return 1 if OP is a comparison operation that is valid for a branch 929 ;; Return 1 if OP is a comparison operation that is valid for a branch
907 ;; insn, which is true if the corresponding bit in the CC register is set. 930 ;; insn, which is true if the corresponding bit in the CC register is set.
908 (define_predicate "branch_positive_comparison_operator" 931 (define_predicate "branch_positive_comparison_operator"
909 (and (match_operand 0 "branch_comparison_operator") 932 (and (match_operand 0 "branch_comparison_operator")