diff options
author | Dale Johannesen <dalej@apple.com> | 2002-04-16 15:25:30 +0000 |
---|---|---|
committer | David Edelsohn <dje@gcc.gnu.org> | 2002-04-16 11:25:30 -0400 |
commit | 3148ad6d93bbe2414b3c973adc501337a9de91d3 (patch) | |
tree | 6747164f5f77d7c53323a1b5cbc4ed843a78dd76 /gcc | |
parent | 014cb9b62a7b5fa7ae2cf83baca43951e5a5f94f (diff) | |
download | gcc-3148ad6d93bbe2414b3c973adc501337a9de91d3.zip gcc-3148ad6d93bbe2414b3c973adc501337a9de91d3.tar.gz gcc-3148ad6d93bbe2414b3c973adc501337a9de91d3.tar.bz2 |
rs6000.c (rs6000_emit_cmove): Fail if modes of comparison operands do not match each other or if...
2002-04-16 Dale Johannesen <dalej@apple.com>
* config/rs6000/rs6000.c (rs6000_emit_cmove): Fail if modes of
comparison operands do not match each other or if modes of
conditions do not match result.
From-SVN: r52367
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 49 |
2 files changed, 35 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99828fd..0ff5bff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-04-16 Dale Johannesen <dalej@apple.com> + + * config/rs6000/rs6000.c (rs6000_emit_cmove): Fail if modes of + comparison operands do not match each other or if modes of + conditions do not match result. + 2002-04-16 Hartmut Penner <hpenner@de.ibm.com> PR target/6305 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 0409810..efd3a0b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7245,9 +7245,18 @@ rs6000_emit_cmove (dest, op, true_cond, false_cond) rtx op0 = rs6000_compare_op0; rtx op1 = rs6000_compare_op1; REAL_VALUE_TYPE c1; - enum machine_mode mode = GET_MODE (op0); + enum machine_mode compare_mode = GET_MODE (op0); + enum machine_mode result_mode = GET_MODE (dest); rtx temp; + /* These modes should always match. */ + if ( GET_MODE (op1) != compare_mode ) + return 0; + if ( GET_MODE (true_cond) != result_mode ) + return 0; + if ( GET_MODE (false_cond) != result_mode ) + return 0; + /* First, work out if the hardware can do this at all, or if it's too slow... */ /* If the comparison is an integer one, since we only have fsel @@ -7290,11 +7299,11 @@ rs6000_emit_cmove (dest, op, true_cond, false_cond) /* At this point we know we can use fsel. */ /* Reduce the comparison to a comparison against zero. */ - temp = gen_reg_rtx (mode); + temp = gen_reg_rtx (compare_mode); emit_insn (gen_rtx_SET (VOIDmode, temp, - gen_rtx_MINUS (mode, op0, op1))); + gen_rtx_MINUS (compare_mode, op0, op1))); op0 = temp; - op1 = CONST0_RTX (mode); + op1 = CONST0_RTX (compare_mode); /* If we don't care about NaNs we can reduce some of the comparisons down to faster ones. */ @@ -7324,52 +7333,52 @@ rs6000_emit_cmove (dest, op, true_cond, false_cond) break; case LE: - temp = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (mode, op0))); + temp = gen_reg_rtx (compare_mode); + emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (compare_mode, op0))); op0 = temp; break; case ORDERED: - temp = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_ABS (mode, op0))); + temp = gen_reg_rtx (compare_mode); + emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_ABS (compare_mode, op0))); op0 = temp; break; case EQ: - temp = gen_reg_rtx (mode); + temp = gen_reg_rtx (compare_mode); emit_insn (gen_rtx_SET (VOIDmode, temp, - gen_rtx_NEG (mode, - gen_rtx_ABS (mode, op0)))); + gen_rtx_NEG (compare_mode, + gen_rtx_ABS (compare_mode, op0)))); op0 = temp; break; case UNGE: - temp = gen_reg_rtx (mode); + temp = gen_reg_rtx (result_mode); emit_insn (gen_rtx_SET (VOIDmode, temp, - gen_rtx_IF_THEN_ELSE (mode, + gen_rtx_IF_THEN_ELSE (result_mode, gen_rtx_GE (VOIDmode, op0, op1), true_cond, false_cond))); false_cond = temp; true_cond = false_cond; - temp = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (mode, op0))); + temp = gen_reg_rtx (compare_mode); + emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (compare_mode, op0))); op0 = temp; break; case GT: - temp = gen_reg_rtx (mode); + temp = gen_reg_rtx (result_mode); emit_insn (gen_rtx_SET (VOIDmode, temp, - gen_rtx_IF_THEN_ELSE (mode, + gen_rtx_IF_THEN_ELSE (result_mode, gen_rtx_GE (VOIDmode, op0, op1), true_cond, false_cond))); true_cond = temp; false_cond = true_cond; - temp = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (mode, op0))); + temp = gen_reg_rtx (compare_mode); + emit_insn (gen_rtx_SET (VOIDmode, temp, gen_rtx_NEG (compare_mode, op0))); op0 = temp; break; @@ -7378,7 +7387,7 @@ rs6000_emit_cmove (dest, op, true_cond, false_cond) } emit_insn (gen_rtx_SET (VOIDmode, dest, - gen_rtx_IF_THEN_ELSE (GET_MODE (dest), + gen_rtx_IF_THEN_ELSE (result_mode, gen_rtx_GE (VOIDmode, op0, op1), true_cond, false_cond))); |