From 2c6a427ff9a15735ff7162eae5cbb18cffc5d7cf Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Mon, 23 Feb 2015 19:16:34 +0000 Subject: [PATCH] re PR target/65163 ([SH] ICE in decompose at rtl.h:2007) gcc/ PR target/65163 * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536 instead of const_int 4294901760. gcc/testsuite/ PR target/65163 * gcc.c-torture/compile/pr65163.c: New. From-SVN: r220916 --- gcc/ChangeLog | 6 +++++ gcc/config/sh/sh.md | 6 ++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr65163.c | 22 +++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr65163.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d986bbc0da3..5a652bce77f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-23 Oleg Endo + + PR target/65163 + * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536 + instead of const_int 4294901760. + 2015-02-23 Georg-Johann Lay * config/avr/t-avr: Fix typo in comment. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 94a01af6ba0..3461edbc124 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -6218,7 +6218,7 @@ label: (define_insn "swapbsi2" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "r") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) @@ -6286,7 +6286,7 @@ label: (define_peephole2 [(set (match_operand:SI 0 "arith_reg_dest" "") (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) @@ -6296,7 +6296,7 @@ label: "TARGET_SH1 && peep2_reg_dead_p (2, operands[0])" [(set (match_dup 2) (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 403bd5ee538..4c894b6f564 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-23 Oleg Endo + + PR target/65163 + * gcc.c-torture/compile/pr65163.c: New. + 2015-02-23 Andreas Krebbel * gcc.dg/hoist-register-pressure-1.c: Make S/390 target check work diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65163.c b/gcc/testsuite/gcc.c-torture/compile/pr65163.c new file mode 100644 index 00000000000..3a6b2880e31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr65163.c @@ -0,0 +1,22 @@ +/* PR target/65163 */ + +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +union unaligned_32 { uint32_t l; } __attribute__((packed)); +union unaligned_16 { uint16_t l; } __attribute__((packed)); + +int +test_00 (unsigned char* buf, int bits_per_component) +{ + (((union unaligned_32*)(buf))->l) = + __builtin_bswap32 (bits_per_component == 10 ? 1 : 0); + return 0; +} + +int +test_01 (unsigned char* buf, int bits_per_component) +{ + (((union unaligned_16*)(buf))->l) = + __builtin_bswap16 (bits_per_component == 10 ? 1 : 0); + return 0; +} -- 2.30.2