comparison gcc/config/v850/predicates.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ;; Predicate definitions for NEC V850. 1 ;; Predicate definitions for NEC V850.
2 ;; Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc. 2 ;; Copyright (C) 2005-2017 Free Software Foundation, Inc.
3 ;; 3 ;;
4 ;; This file is part of GCC. 4 ;; This file is part of GCC.
5 ;; 5 ;;
6 ;; GCC is free software; you can redistribute it and/or modify 6 ;; 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 7 ;; it under the terms of the GNU General Public License as published by
496 return 0; 496 return 0;
497 497
498 return op == CONST0_RTX(mode); 498 return op == CONST0_RTX(mode);
499 }) 499 })
500 500
501 501 (define_predicate "label_ref_operand"
502 (match_code "label_ref")
503 )
504
505
506 (define_predicate "e3v5_shift_operand"
507 (match_code "const_int,reg")
508 {
509 if (CONST_INT_P (op))
510 return IN_RANGE (INTVAL (op), 0, 31);
511 return true;
512 }
513 )
514
515 (define_predicate "ior_operator"
516 (match_code "ior")
517 {
518 return (GET_CODE (op) == IOR);
519 })
520
521 ;; Return true if the floating point comparison operation
522 ;; given produces a canonical answer.
523 (define_predicate "v850_float_z_comparison_operator"
524 (match_code "lt,le,eq,gt,ge")
525 {
526 enum rtx_code code = GET_CODE (op);
527
528 if (GET_RTX_CLASS (code) != RTX_COMPARE
529 && GET_RTX_CLASS (code) != RTX_COMM_COMPARE)
530 return 0;
531
532 if (mode != GET_MODE (op) && mode != VOIDmode)
533 return 0;
534
535 if ((GET_CODE (XEXP (op, 0)) != REG
536 || REGNO (XEXP (op, 0)) != CC_REGNUM)
537 || XEXP (op, 1) != const0_rtx)
538 return 0;
539
540 if (GET_MODE (XEXP (op, 0)) == CC_FPU_LTmode)
541 return code == LT;
542 if (GET_MODE (XEXP (op, 0)) == CC_FPU_LEmode)
543 return code == LE;
544 if (GET_MODE (XEXP (op, 0)) == CC_FPU_EQmode)
545 return code == EQ;
546 if (GET_MODE (XEXP (op, 0)) == CC_FPU_GTmode)
547 return code == GT;
548 if (GET_MODE (XEXP (op, 0)) == CC_FPU_GEmode)
549 return code == GE;
550
551 /* Note we do not accept CC_FPU_NEmode here. See
552 v850_float_nz_comparison for the reason why. */
553 return 0;
554 })
555
556 ;; Return true if the floating point comparison operation
557 ;; given produces an inverted answer.
558 (define_predicate "v850_float_nz_comparison_operator"
559 (match_code "ne")
560 {
561 enum rtx_code code = GET_CODE (op);
562
563 /* The V850E2V3 does not have a floating point NZ comparison operator.
564 Instead it is implemented as an EQ comparison and this function ensures
565 that the branch_nz_normal and set_nz_insn patterns are used to examine
566 (and invert) the result of the floating point comparison. */
567
568 if (GET_RTX_CLASS (code) != RTX_COMPARE
569 && GET_RTX_CLASS (code) != RTX_COMM_COMPARE)
570 return 0;
571
572 if (mode != GET_MODE (op) && mode != VOIDmode)
573 return 0;
574
575 if ((GET_CODE (XEXP (op, 0)) != REG
576 || REGNO (XEXP (op, 0)) != CC_REGNUM)
577 || XEXP (op, 1) != const0_rtx)
578 return 0;
579
580 if (GET_MODE (XEXP (op, 0)) == CC_FPU_NEmode)
581 return code == NE;
582
583 return 0;
584 })