From 6d499e4483657c6515dfee95c445a29d1adb5185 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 16 Jul 2013 22:45:32 +0000 Subject: compiler: adjust closure field indexes This corrects the code that handles composite literals where the key is a variable in an enclosing function. See bug475.go in the testsuite. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@200991 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index a21493a786c..6ae72b6a1c9 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3380,7 +3380,7 @@ Function::set_closure_type() st->push_field(Struct_field(Typed_identifier(".$f", voidptr_type, this->location_))); - unsigned int index = 0; + unsigned int index = 1; for (Closure_fields::const_iterator p = this->closure_fields_.begin(); p != this->closure_fields_.end(); ++p, ++index) -- cgit v1.2.3 From efbebeb0dc128376f3f1c0a26771535e6387b7c4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 17 Jul 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@200995 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 79a747b6775..a7d2d8a599e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130716 +20130717 -- cgit v1.2.3 From 8f8eac2de4780e94afc12e4460c19899a6828e23 Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Wed, 17 Jul 2013 09:06:21 +0000 Subject: [AArch64] Convert ld1, st1 arm_neon.h intrinsics to RTL builtins. Backport From mainline: 2013-07-03 James Greenhalgh * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_builtin): Handle AARCH64_SIMD_STORE1. * config/aarch64/aarch64-simd-builtins.def (ld1): New. (st1): Likewise. * config/aarch64/aarch64-simd.md (aarch64_ld1): New. (aarch64_st1): Likewise. * config/aarch64/arm_neon.h (vld1_<8, 16, 32, 64>): Convert to RTL builtins. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201003 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 + gcc/config/aarch64/aarch64-builtins.c | 1 + gcc/config/aarch64/aarch64-simd-builtins.def | 7 + gcc/config/aarch64/aarch64-simd.md | 22 + gcc/config/aarch64/arm_neon.h | 797 +++++++++++---------------- 5 files changed, 363 insertions(+), 479 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ff557bcbc8..f72ba009fb5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2013-07-17 James Greenhalgh + + Backport From mainline: + 2013-07-03 James Greenhalgh + + * config/aarch64/aarch64-builtins.c + (aarch64_simd_expand_builtin): Handle AARCH64_SIMD_STORE1. + * config/aarch64/aarch64-simd-builtins.def (ld1): New. + (st1): Likewise. + * config/aarch64/aarch64-simd.md + (aarch64_ld1): New. + (aarch64_st1): Likewise. + * config/aarch64/arm_neon.h + (vld1_<8, 16, 32, 64>): Convert to RTL builtins. + 2013-07-11 Georg-Johann Lay Backport from 2013-07-11 trunk r200901. diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index 1ea55a83eb8..b2901dbcab2 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -1154,6 +1154,7 @@ aarch64_simd_expand_builtin (int fcode, tree exp, rtx target) return aarch64_simd_expand_args (target, icode, 1, exp, SIMD_ARG_COPY_TO_REG, SIMD_ARG_STOP); + case AARCH64_SIMD_STORE1: case AARCH64_SIMD_STORESTRUCT: return aarch64_simd_expand_args (target, icode, 0, exp, SIMD_ARG_COPY_TO_REG, diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index a6a5e12c7a5..955da265afd 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -256,3 +256,10 @@ BUILTIN_VALL (BINOP, uzp2) BUILTIN_VALL (BINOP, trn1) BUILTIN_VALL (BINOP, trn2) + + /* Implemented by aarch64_ld1. */ + BUILTIN_VALL (LOAD1, ld1) + + /* Implemented by aarch64_st1. */ + BUILTIN_VALL (STORE1, st1) + diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 79c30933115..00f3c3121f0 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -3457,6 +3457,17 @@ DONE; }) +(define_expand "aarch64_ld1" + [(match_operand:VALL 0 "register_operand") + (match_operand:DI 1 "register_operand")] + "TARGET_SIMD" +{ + enum machine_mode mode = mode; + rtx mem = gen_rtx_MEM (mode, operands[1]); + emit_move_insn (operands[0], mem); + DONE; +}) + (define_expand "aarch64_ld" [(match_operand:VSTRUCT 0 "register_operand" "=w") (match_operand:DI 1 "register_operand" "r") @@ -3673,6 +3684,17 @@ DONE; }) +(define_expand "aarch64_st1" + [(match_operand:DI 0 "register_operand") + (match_operand:VALL 1 "register_operand")] + "TARGET_SIMD" +{ + enum machine_mode mode = mode; + rtx mem = gen_rtx_MEM (mode, operands[0]); + emit_move_insn (mem, operands[1]); + DONE; +}) + ;; Expander for builtins to insert vector registers into large ;; opaque integer modes. diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 669217e2762..60e1f7d438c 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -8518,28 +8518,6 @@ vld1_dup_u64 (const uint64_t * a) return result; } -__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) -vld1_f32 (const float32_t * a) -{ - float32x2_t result; - __asm__ ("ld1 {%0.2s}, %1" - : "=w"(result) - : "Utv"(({const float32x2_t *_a = (float32x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) -vld1_f64 (const float64_t * a) -{ - float64x1_t result; - __asm__ ("ld1 {%0.1d}, %1" - : "=w"(result) - : "Utv"(*a) - : /* No clobbers */); - return result; -} - #define vld1_lane_f32(a, b, c) \ __extension__ \ ({ \ @@ -8696,116 +8674,6 @@ vld1_f64 (const float64_t * a) result; \ }) -__extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) -vld1_p8 (const poly8_t * a) -{ - poly8x8_t result; - __asm__ ("ld1 {%0.8b}, %1" - : "=w"(result) - : "Utv"(({const poly8x8_t *_a = (poly8x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) -vld1_p16 (const poly16_t * a) -{ - poly16x4_t result; - __asm__ ("ld1 {%0.4h}, %1" - : "=w"(result) - : "Utv"(({const poly16x4_t *_a = (poly16x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) -vld1_s8 (const int8_t * a) -{ - int8x8_t result; - __asm__ ("ld1 {%0.8b}, %1" - : "=w"(result) - : "Utv"(({const int8x8_t *_a = (int8x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) -vld1_s16 (const int16_t * a) -{ - int16x4_t result; - __asm__ ("ld1 {%0.4h}, %1" - : "=w"(result) - : "Utv"(({const int16x4_t *_a = (int16x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) -vld1_s32 (const int32_t * a) -{ - int32x2_t result; - __asm__ ("ld1 {%0.2s}, %1" - : "=w"(result) - : "Utv"(({const int32x2_t *_a = (int32x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) -vld1_s64 (const int64_t * a) -{ - int64x1_t result; - __asm__ ("ld1 {%0.1d}, %1" - : "=w"(result) - : "Utv"(*a) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) -vld1_u8 (const uint8_t * a) -{ - uint8x8_t result; - __asm__ ("ld1 {%0.8b}, %1" - : "=w"(result) - : "Utv"(({const uint8x8_t *_a = (uint8x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) -vld1_u16 (const uint16_t * a) -{ - uint16x4_t result; - __asm__ ("ld1 {%0.4h}, %1" - : "=w"(result) - : "Utv"(({const uint16x4_t *_a = (uint16x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) -vld1_u32 (const uint32_t * a) -{ - uint32x2_t result; - __asm__ ("ld1 {%0.2s}, %1" - : "=w"(result) - : "Utv"(({const uint32x2_t *_a = (uint32x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) -vld1_u64 (const uint64_t * a) -{ - uint64x1_t result; - __asm__ ("ld1 {%0.1d}, %1" - : "=w"(result) - : "Utv"(*a) - : /* No clobbers */); - return result; -} - __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_dup_f32 (const float32_t * a) { @@ -8938,28 +8806,6 @@ vld1q_dup_u64 (const uint64_t * a) return result; } -__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) -vld1q_f32 (const float32_t * a) -{ - float32x4_t result; - __asm__ ("ld1 {%0.4s}, %1" - : "=w"(result) - : "Utv"(({const float32x4_t *_a = (float32x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline float64x2_t __attribute__ ((__always_inline__)) -vld1q_f64 (const float64_t * a) -{ - float64x2_t result; - __asm__ ("ld1 {%0.2d}, %1" - : "=w"(result) - : "Utv"(({const float64x2_t *_a = (float64x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - #define vld1q_lane_f32(a, b, c) \ __extension__ \ ({ \ @@ -9116,116 +8962,6 @@ vld1q_f64 (const float64_t * a) result; \ }) -__extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) -vld1q_p8 (const poly8_t * a) -{ - poly8x16_t result; - __asm__ ("ld1 {%0.16b}, %1" - : "=w"(result) - : "Utv"(({const poly8x16_t *_a = (poly8x16_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) -vld1q_p16 (const poly16_t * a) -{ - poly16x8_t result; - __asm__ ("ld1 {%0.16b}, %1" - : "=w"(result) - : "Utv"(({const poly16x8_t *_a = (poly16x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) -vld1q_s8 (const int8_t * a) -{ - int8x16_t result; - __asm__ ("ld1 {%0.16b}, %1" - : "=w"(result) - : "Utv"(({const int8x16_t *_a = (int8x16_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) -vld1q_s16 (const int16_t * a) -{ - int16x8_t result; - __asm__ ("ld1 {%0.8h}, %1" - : "=w"(result) - : "Utv"(({const int16x8_t *_a = (int16x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) -vld1q_s32 (const int32_t * a) -{ - int32x4_t result; - __asm__ ("ld1 {%0.4s}, %1" - : "=w"(result) - : "Utv"(({const int32x4_t *_a = (int32x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) -vld1q_s64 (const int64_t * a) -{ - int64x2_t result; - __asm__ ("ld1 {%0.2d}, %1" - : "=w"(result) - : "Utv"(({const int64x2_t *_a = (int64x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) -vld1q_u8 (const uint8_t * a) -{ - uint8x16_t result; - __asm__ ("ld1 {%0.16b}, %1" - : "=w"(result) - : "Utv"(({const uint8x16_t *_a = (uint8x16_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) -vld1q_u16 (const uint16_t * a) -{ - uint16x8_t result; - __asm__ ("ld1 {%0.8h}, %1" - : "=w"(result) - : "Utv"(({const uint16x8_t *_a = (uint16x8_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) -vld1q_u32 (const uint32_t * a) -{ - uint32x4_t result; - __asm__ ("ld1 {%0.4s}, %1" - : "=w"(result) - : "Utv"(({const uint32x4_t *_a = (uint32x4_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - -__extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) -vld1q_u64 (const uint64_t * a) -{ - uint64x2_t result; - __asm__ ("ld1 {%0.2d}, %1" - : "=w"(result) - : "Utv"(({const uint64x2_t *_a = (uint64x2_t *) a; *_a;})) - : /* No clobbers */); - return result; -} - __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vmaxnm_f32 (float32x2_t a, float32x2_t b) { @@ -16285,24 +16021,6 @@ vrsubhn_u64 (uint64x2_t a, uint64x2_t b) result; \ }) -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_f32 (float32_t * a, float32x2_t b) -{ - __asm__ ("st1 {%1.2s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_f64 (float64_t * a, float64x1_t b) -{ - __asm__ ("st1 {%1.1d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - #define vst1_lane_f32(a, b, c) \ __extension__ \ ({ \ @@ -16435,113 +16153,6 @@ vst1_f64 (float64_t * a, float64x1_t b) : "memory"); \ }) -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_p8 (poly8_t * a, poly8x8_t b) -{ - __asm__ ("st1 {%1.8b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_p16 (poly16_t * a, poly16x4_t b) -{ - __asm__ ("st1 {%1.4h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_s8 (int8_t * a, int8x8_t b) -{ - __asm__ ("st1 {%1.8b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_s16 (int16_t * a, int16x4_t b) -{ - __asm__ ("st1 {%1.4h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_s32 (int32_t * a, int32x2_t b) -{ - __asm__ ("st1 {%1.2s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_s64 (int64_t * a, int64x1_t b) -{ - __asm__ ("st1 {%1.1d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_u8 (uint8_t * a, uint8x8_t b) -{ - __asm__ ("st1 {%1.8b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_u16 (uint16_t * a, uint16x4_t b) -{ - __asm__ ("st1 {%1.4h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_u32 (uint32_t * a, uint32x2_t b) -{ - __asm__ ("st1 {%1.2s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1_u64 (uint64_t * a, uint64x1_t b) -{ - __asm__ ("st1 {%1.1d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_f32 (float32_t * a, float32x4_t b) -{ - __asm__ ("st1 {%1.4s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_f64 (float64_t * a, float64x2_t b) -{ - __asm__ ("st1 {%1.2d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} #define vst1q_lane_f32(a, b, c) \ __extension__ \ @@ -16675,96 +16286,6 @@ vst1q_f64 (float64_t * a, float64x2_t b) : "memory"); \ }) -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_p8 (poly8_t * a, poly8x16_t b) -{ - __asm__ ("st1 {%1.16b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_p16 (poly16_t * a, poly16x8_t b) -{ - __asm__ ("st1 {%1.8h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_s8 (int8_t * a, int8x16_t b) -{ - __asm__ ("st1 {%1.16b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_s16 (int16_t * a, int16x8_t b) -{ - __asm__ ("st1 {%1.8h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_s32 (int32_t * a, int32x4_t b) -{ - __asm__ ("st1 {%1.4s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_s64 (int64_t * a, int64x2_t b) -{ - __asm__ ("st1 {%1.2d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_u8 (uint8_t * a, uint8x16_t b) -{ - __asm__ ("st1 {%1.16b},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_u16 (uint16_t * a, uint16x8_t b) -{ - __asm__ ("st1 {%1.8h},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_u32 (uint32_t * a, uint32x4_t b) -{ - __asm__ ("st1 {%1.4s},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - -__extension__ static __inline void __attribute__ ((__always_inline__)) -vst1q_u64 (uint64_t * a, uint64x2_t b) -{ - __asm__ ("st1 {%1.2d},[%0]" - : - : "r"(a), "w"(b) - : "memory"); -} - __extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) vsubhn_high_s16 (int8x8_t a, int16x8_t b, int16x8_t c) { @@ -20537,6 +20058,165 @@ vdupd_lane_u64 (uint64x2_t a, int const b) return (uint64x1_t) __builtin_aarch64_dup_lanedi ((int64x2_t) a, b); } +/* vld1 */ + +__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) +vld1_f32 (const float32_t *a) +{ + return __builtin_aarch64_ld1v2sf ((const __builtin_aarch64_simd_sf *) a); +} + +__extension__ static __inline float64x1_t __attribute__ ((__always_inline__)) +vld1_f64 (const float64_t *a) +{ + return *a; +} + +__extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) +vld1_p8 (const poly8_t *a) +{ + return (poly8x8_t) + __builtin_aarch64_ld1v8qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) +vld1_p16 (const poly16_t *a) +{ + return (poly16x4_t) + __builtin_aarch64_ld1v4hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +vld1_s8 (const int8_t *a) +{ + return __builtin_aarch64_ld1v8qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +vld1_s16 (const int16_t *a) +{ + return __builtin_aarch64_ld1v4hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +vld1_s32 (const int32_t *a) +{ + return __builtin_aarch64_ld1v2si ((const __builtin_aarch64_simd_si *) a); +} + +__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) +vld1_s64 (const int64_t *a) +{ + return *a; +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +vld1_u8 (const uint8_t *a) +{ + return (uint8x8_t) + __builtin_aarch64_ld1v8qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +vld1_u16 (const uint16_t *a) +{ + return (uint16x4_t) + __builtin_aarch64_ld1v4hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +vld1_u32 (const uint32_t *a) +{ + return (uint32x2_t) + __builtin_aarch64_ld1v2si ((const __builtin_aarch64_simd_si *) a); +} + +__extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) +vld1_u64 (const uint64_t *a) +{ + return *a; +} + +/* vld1q */ + +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vld1q_f32 (const float32_t *a) +{ + return __builtin_aarch64_ld1v4sf ((const __builtin_aarch64_simd_sf *) a); +} + +__extension__ static __inline float64x2_t __attribute__ ((__always_inline__)) +vld1q_f64 (const float64_t *a) +{ + return __builtin_aarch64_ld1v2df ((const __builtin_aarch64_simd_df *) a); +} + +__extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) +vld1q_p8 (const poly8_t *a) +{ + return (poly8x16_t) + __builtin_aarch64_ld1v16qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) +vld1q_p16 (const poly16_t *a) +{ + return (poly16x8_t) + __builtin_aarch64_ld1v8hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) +vld1q_s8 (const int8_t *a) +{ + return __builtin_aarch64_ld1v16qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) +vld1q_s16 (const int16_t *a) +{ + return __builtin_aarch64_ld1v8hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) +vld1q_s32 (const int32_t *a) +{ + return __builtin_aarch64_ld1v4si ((const __builtin_aarch64_simd_si *) a); +} + +__extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) +vld1q_s64 (const int64_t *a) +{ + return __builtin_aarch64_ld1v2di ((const __builtin_aarch64_simd_di *) a); +} + +__extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) +vld1q_u8 (const uint8_t *a) +{ + return (uint8x16_t) + __builtin_aarch64_ld1v16qi ((const __builtin_aarch64_simd_qi *) a); +} + +__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) +vld1q_u16 (const uint16_t *a) +{ + return (uint16x8_t) + __builtin_aarch64_ld1v8hi ((const __builtin_aarch64_simd_hi *) a); +} + +__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) +vld1q_u32 (const uint32_t *a) +{ + return (uint32x4_t) + __builtin_aarch64_ld1v4si ((const __builtin_aarch64_simd_si *) a); +} + +__extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) +vld1q_u64 (const uint64_t *a) +{ + return (uint64x2_t) + __builtin_aarch64_ld1v2di ((const __builtin_aarch64_simd_di *) a); +} + /* vldn */ __extension__ static __inline int64x1x2_t __attribute__ ((__always_inline__)) @@ -24307,6 +23987,165 @@ vsrid_n_u64 (uint64x1_t __a, uint64x1_t __b, const int __c) return (uint64x1_t) __builtin_aarch64_usri_ndi (__a, __b, __c); } +/* vst1 */ + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_f32 (float32_t *a, float32x2_t b) +{ + __builtin_aarch64_st1v2sf ((__builtin_aarch64_simd_sf *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_f64 (float64_t *a, float64x1_t b) +{ + *a = b; +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_p8 (poly8_t *a, poly8x8_t b) +{ + __builtin_aarch64_st1v8qi ((__builtin_aarch64_simd_qi *) a, + (int8x8_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_p16 (poly16_t *a, poly16x4_t b) +{ + __builtin_aarch64_st1v4hi ((__builtin_aarch64_simd_hi *) a, + (int16x4_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_s8 (int8_t *a, int8x8_t b) +{ + __builtin_aarch64_st1v8qi ((__builtin_aarch64_simd_qi *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_s16 (int16_t *a, int16x4_t b) +{ + __builtin_aarch64_st1v4hi ((__builtin_aarch64_simd_hi *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_s32 (int32_t *a, int32x2_t b) +{ + __builtin_aarch64_st1v2si ((__builtin_aarch64_simd_si *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_s64 (int64_t *a, int64x1_t b) +{ + *a = b; +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_u8 (uint8_t *a, uint8x8_t b) +{ + __builtin_aarch64_st1v8qi ((__builtin_aarch64_simd_qi *) a, + (int8x8_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_u16 (uint16_t *a, uint16x4_t b) +{ + __builtin_aarch64_st1v4hi ((__builtin_aarch64_simd_hi *) a, + (int16x4_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_u32 (uint32_t *a, uint32x2_t b) +{ + __builtin_aarch64_st1v2si ((__builtin_aarch64_simd_si *) a, + (int32x2_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_u64 (uint64_t *a, uint64x1_t b) +{ + *a = b; +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_f32 (float32_t *a, float32x4_t b) +{ + __builtin_aarch64_st1v4sf ((__builtin_aarch64_simd_sf *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_f64 (float64_t *a, float64x2_t b) +{ + __builtin_aarch64_st1v2df ((__builtin_aarch64_simd_df *) a, b); +} + +/* vst1q */ + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_p8 (poly8_t *a, poly8x16_t b) +{ + __builtin_aarch64_st1v16qi ((__builtin_aarch64_simd_qi *) a, + (int8x16_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_p16 (poly16_t *a, poly16x8_t b) +{ + __builtin_aarch64_st1v8hi ((__builtin_aarch64_simd_hi *) a, + (int16x8_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_s8 (int8_t *a, int8x16_t b) +{ + __builtin_aarch64_st1v16qi ((__builtin_aarch64_simd_qi *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_s16 (int16_t *a, int16x8_t b) +{ + __builtin_aarch64_st1v8hi ((__builtin_aarch64_simd_hi *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_s32 (int32_t *a, int32x4_t b) +{ + __builtin_aarch64_st1v4si ((__builtin_aarch64_simd_si *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_s64 (int64_t *a, int64x2_t b) +{ + __builtin_aarch64_st1v2di ((__builtin_aarch64_simd_di *) a, b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_u8 (uint8_t *a, uint8x16_t b) +{ + __builtin_aarch64_st1v16qi ((__builtin_aarch64_simd_qi *) a, + (int8x16_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_u16 (uint16_t *a, uint16x8_t b) +{ + __builtin_aarch64_st1v8hi ((__builtin_aarch64_simd_hi *) a, + (int16x8_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_u32 (uint32_t *a, uint32x4_t b) +{ + __builtin_aarch64_st1v4si ((__builtin_aarch64_simd_si *) a, + (int32x4_t) b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_u64 (uint64_t *a, uint64x2_t b) +{ + __builtin_aarch64_st1v2di ((__builtin_aarch64_simd_di *) a, + (int64x2_t) b); +} + /* vstn */ __extension__ static __inline void -- cgit v1.2.3 From 06e207f625d196d351bb4149abeaa52c7b66f6eb Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 18 Jul 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201018 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a7d2d8a599e..e2f150f95e5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130717 +20130718 -- cgit v1.2.3 From ad2708888da43df0772507f67504b9834d729070 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 19 Jul 2013 00:16:19 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201044 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e2f150f95e5..5edd869d535 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130718 +20130719 -- cgit v1.2.3 From 468b4966b5908770ee3a68052b551f0869c5a98f Mon Sep 17 00:00:00 2001 From: Kirill Yukhin Date: Fri, 19 Jul 2013 07:38:07 +0000 Subject: ChangeLog/ * config/i386/bmiintrin.h (_bextr_u32): New. (_bextr_u64): Ditto. (_blsi_u32): New. (_blsi_u64): Ditto. (_blsr_u32): Ditto. (_blsr_u64): Ditto. (_blsmsk_u32): Ditto. (_blsmsk_u64): Ditto. (_tzcnt_u32): Ditto. (_tzcnt_u64): Ditto. testsuite/ChangeLog/ * gcc.target/i386/bmi-1.c: Extend with new instrinsics. Fix scan patterns. * gcc.target/i386/bmi-2.c: Ditto. * gcc.target/i386/bmi-bextr-4.c: New. * gcc.target/i386/bmi-bextr-5.c: Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201047 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 ++++++++ gcc/config/i386/bmiintrin.h | 60 ++++++++++++++++++++++++++++++++++- gcc/testsuite/ChangeLog | 8 +++++ gcc/testsuite/gcc.target/i386/bmi-1.c | 44 +++++++++++++++++++++---- gcc/testsuite/gcc.target/i386/bmi-2.c | 44 +++++++++++++++++++++---- 5 files changed, 156 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f72ba009fb5..126b19b8725 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2013-07-19 Kirill Yukhin + + * config/i386/bmiintrin.h (_bextr_u32): New. + (_bextr_u64): Ditto. + (_blsi_u32): New. + (_blsi_u64): Ditto. + (_blsr_u32): Ditto. + (_blsr_u64): Ditto. + (_blsmsk_u32): Ditto. + (_blsmsk_u64): Ditto. + (_tzcnt_u32): Ditto. + (_tzcnt_u64): Ditto. + 2013-07-17 James Greenhalgh Backport From mainline: diff --git a/gcc/config/i386/bmiintrin.h b/gcc/config/i386/bmiintrin.h index 0087f5c06e0..fc7f2ec2212 100644 --- a/gcc/config/i386/bmiintrin.h +++ b/gcc/config/i386/bmiintrin.h @@ -38,7 +38,6 @@ __tzcnt_u16 (unsigned short __X) return __builtin_ctzs (__X); } - extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __andn_u32 (unsigned int __X, unsigned int __Y) { @@ -51,24 +50,47 @@ __bextr_u32 (unsigned int __X, unsigned int __Y) return __builtin_ia32_bextr_u32 (__X, __Y); } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_bextr_u32 (unsigned int __X, unsigned int __Y, unsigned __Z) +{ + return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8))); +} + extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsi_u32 (unsigned int __X) { return __X & -__X; } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsi_u32 (unsigned int __X) +{ + return __blsi_u32 (__X); +} + extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsmsk_u32 (unsigned int __X) { return __X ^ (__X - 1); } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsmsk_u32 (unsigned int __X) +{ + return __blsmsk_u32 (__X); +} + extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsr_u32 (unsigned int __X) { return __X & (__X - 1); } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsr_u32 (unsigned int __X) +{ + return __blsr_u32 (__X); +} extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __tzcnt_u32 (unsigned int __X) @@ -76,6 +98,12 @@ __tzcnt_u32 (unsigned int __X) return __builtin_ctz (__X); } +extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_tzcnt_u32 (unsigned int __X) +{ + return __builtin_ctz (__X); +} + #ifdef __x86_64__ extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) @@ -90,30 +118,60 @@ __bextr_u64 (unsigned long long __X, unsigned long long __Y) return __builtin_ia32_bextr_u64 (__X, __Y); } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_bextr_u64 (unsigned long long __X, unsigned int __Y, unsigned int __Z) +{ + return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8))); +} + extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsi_u64 (unsigned long long __X) { return __X & -__X; } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsi_u64 (unsigned long long __X) +{ + return __blsi_u64 (__X); +} + extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsmsk_u64 (unsigned long long __X) { return __X ^ (__X - 1); } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsmsk_u64 (unsigned long long __X) +{ + return __blsmsk_u64 (__X); +} + extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __blsr_u64 (unsigned long long __X) { return __X & (__X - 1); } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_blsr_u64 (unsigned long long __X) +{ + return __blsr_u64 (__X); +} + extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) __tzcnt_u64 (unsigned long long __X) { return __builtin_ctzll (__X); } +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_tzcnt_u64 (unsigned long long __X) +{ + return __builtin_ctzll (__X); +} + #endif /* __x86_64__ */ #endif /* _BMIINTRIN_H_INCLUDED */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89b307df7a2..b60876ae549 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-07-19 Kirill Yukhin + + * gcc.target/i386/bmi-1.c: Extend with new instrinsics. + Fix scan patterns. + * gcc.target/i386/bmi-2.c: Ditto. + * gcc.target/i386/bmi-bextr-4.c: New. + * gcc.target/i386/bmi-bextr-5.c: Ditto. + 2013-07-16 Iain Sandoe PR target/55656 diff --git a/gcc/testsuite/gcc.target/i386/bmi-1.c b/gcc/testsuite/gcc.target/i386/bmi-1.c index dc964ba3d92..c66a9d83b29 100644 --- a/gcc/testsuite/gcc.target/i386/bmi-1.c +++ b/gcc/testsuite/gcc.target/i386/bmi-1.c @@ -1,11 +1,11 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbmi " } */ -/* { dg-final { scan-assembler "andn\[^\\n]*(%|)eax" } } */ -/* { dg-final { scan-assembler "bextr\[^\\n]*(%|)eax" } } */ -/* { dg-final { scan-assembler "blsi\[^\\n]*(%|)eax" } } */ -/* { dg-final { scan-assembler "blsmsk\[^\\n]*(%|)eax" } } */ -/* { dg-final { scan-assembler "blsr\[^\\n]*(%|)eax" } } */ -/* { dg-final { scan-assembler "tzcntl\[^\\n]*(%|)eax" } } */ +/* { dg-final { scan-assembler "andn\[^\\n]*eax" } } */ +/* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*eax" 2 } } */ +/* { dg-final { scan-assembler-times "blsi\[^\\n]*eax" 2 } } */ +/* { dg-final { scan-assembler-times "blsmsk\[^\\n]*eax" 2 } } */ +/* { dg-final { scan-assembler-times "blsr\[^\\n]*eax" 2 } } */ +/* { dg-final { scan-assembler-times "tzcntl\[^\\n]*eax" 2 } } */ #include @@ -21,26 +21,58 @@ func_bextr32 (unsigned int X, unsigned int Y) return __bextr_u32(X, Y); } +unsigned int +func_bextr32_3args (unsigned int X, + unsigned int Y, + unsigned int Z) +{ + return _bextr_u32(X, Y, Z); +} + unsigned int func_blsi32 (unsigned int X) { return __blsi_u32(X); } +unsigned int +func_blsi32_2 (unsigned int X) +{ + return _blsi_u32(X); +} + unsigned int func_blsmsk32 (unsigned int X) { return __blsmsk_u32(X); } +unsigned int +func_blsmsk32_2 (unsigned int X) +{ + return _blsmsk_u32(X); +} + unsigned int func_blsr32 (unsigned int X) { return __blsr_u32(X); } +unsigned int +func_blsr32_2 (unsigned int X) +{ + return _blsr_u32(X); +} + unsigned int func_tzcnt32 (unsigned int X) { return __tzcnt_u32(X); } + +unsigned int +func_tzcnt32_2 (unsigned int X) +{ + return _tzcnt_u32(X); +} diff --git a/gcc/testsuite/gcc.target/i386/bmi-2.c b/gcc/testsuite/gcc.target/i386/bmi-2.c index 56f73876d0c..6eea66aa0f6 100644 --- a/gcc/testsuite/gcc.target/i386/bmi-2.c +++ b/gcc/testsuite/gcc.target/i386/bmi-2.c @@ -1,11 +1,11 @@ /* { dg-do compile { target { ! { ia32 } } } } */ /* { dg-options "-O2 -mbmi " } */ -/* { dg-final { scan-assembler "andn\[^\\n]*(%|)rax" } } */ -/* { dg-final { scan-assembler "bextr\[^\\n]*(%|)rax" } } */ -/* { dg-final { scan-assembler "blsi\[^\\n]*(%|)rax" } } */ -/* { dg-final { scan-assembler "blsmsk\[^\\n]*(%|)rax" } } */ -/* { dg-final { scan-assembler "blsr\[^\\n]*(%|)rax" } } */ -/* { dg-final { scan-assembler "tzcntq\[^\\n]*(%|)rax" } } */ +/* { dg-final { scan-assembler "andn\[^\\n]*rax" } } */ +/* { dg-final { scan-assembler-times "bextr\[ \\t]+\[^\\n]*rax" 2 } } */ +/* { dg-final { scan-assembler-times "blsi\[^\\n]*rax" 2 } } */ +/* { dg-final { scan-assembler-times "blsmsk\[^\\n]*rax" 2 } } */ +/* { dg-final { scan-assembler-times "blsr\[^\\n]*rax" 2 } } */ +/* { dg-final { scan-assembler-times "tzcntq\[^\\n]*rax" 2 } } */ #include @@ -21,26 +21,58 @@ func_bextr64 (unsigned long long X, unsigned long long Y) return __bextr_u64 (X, Y); } +unsigned long long +func_bextr64_3args (unsigned long long X, + unsigned long long Y, + unsigned long long Z) +{ + return _bextr_u64 (X, Y, Z); +} + unsigned long long func_blsi64 (unsigned long long X) { return __blsi_u64 (X); } +unsigned long long +func_blsi64_2 (unsigned long long X) +{ + return _blsi_u64 (X); +} + unsigned long long func_blsmsk64 (unsigned long long X) { return __blsmsk_u64 (X); } +unsigned long long +func_blsmsk64_2 (unsigned long long X) +{ + return _blsmsk_u64 (X); +} + unsigned long long func_blsr64 (unsigned long long X) { return __blsr_u64 (X); } +unsigned long long +func_blsr64_2 (unsigned long long X) +{ + return _blsr_u64 (X); +} + unsigned long long func_tzcnt64 (unsigned long long X) { return __tzcnt_u64 (X); } + +unsigned long long +func_tzcnt64_2 (unsigned long long X) +{ + return _tzcnt_u64 (X); +} -- cgit v1.2.3 From c8a7ad436783bf498ee803f60458253e3e7cef68 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Fri, 19 Jul 2013 11:15:26 +0000 Subject: gcc/ Backport from 2013-07-19 trunk r201051. PR target/57516 * config/avr/avr-fixed.md (round3_const): Turn expander to insn. * config/avr/avr.md (adjust_len): Add `round'. * config/avr/avr-protos.h (avr_out_round): New prototype. (avr_out_plus): Add `out_label' argument. * config/avr/avr.c (avr_out_plus_1): Add `out_label' argument. (avr_out_plus): Pass down `out_label' to avr_out_plus_1. Handle the case where `insn' is just a pattern. (avr_out_bitop): Handle the case where `insn' is just a pattern. (avr_out_round): New function. (avr_adjust_insn_length): Handle ADJUST_LEN_ROUND. libgcc/ Backport from 2013-07-19 trunk r201051. PR target/57516 * config/avr/lib1funcs-fixed.S (__roundqq3, __rounduqq3) (__round_s2_const, __round_u2_const) (__round_s4_const, __round_u4_const, __round_x8): Saturate result if addition result cannot be represented. gcc/testsuite/ Backport from 2013-07-19 trunk r201051. PR target/57516 * gcc.target/avr/torture/builtins-4-roundfx.c (test2hr, test2k): Adjust to corrected rounding. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201052 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++++ gcc/config/avr/avr-fixed.md | 51 ++-------- gcc/config/avr/avr-protos.h | 3 +- gcc/config/avr/avr.c | 104 +++++++++++++++++---- gcc/config/avr/avr.md | 2 +- gcc/testsuite/ChangeLog | 8 ++ .../gcc.target/avr/torture/builtins-4-roundfx.c | 21 +++-- libgcc/ChangeLog | 10 ++ libgcc/config/avr/lib1funcs-fixed.S | 47 +++++----- 9 files changed, 173 insertions(+), 89 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 126b19b8725..e6277bf79ba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2013-07-11 Georg-Johann Lay + + Backport from 2013-07-19 trunk r201051. + + PR target/57516 + * config/avr/avr-fixed.md (round3_const): Turn expander to insn. + * config/avr/avr.md (adjust_len): Add `round'. + * config/avr/avr-protos.h (avr_out_round): New prototype. + (avr_out_plus): Add `out_label' argument. + * config/avr/avr.c (avr_out_plus_1): Add `out_label' argument. + (avr_out_plus): Pass down `out_label' to avr_out_plus_1. + Handle the case where `insn' is just a pattern. + (avr_out_bitop): Handle the case where `insn' is just a pattern. + (avr_out_round): New function. + (avr_adjust_insn_length): Handle ADJUST_LEN_ROUND. + 2013-07-19 Kirill Yukhin * config/i386/bmiintrin.h (_bextr_u32): New. diff --git a/gcc/config/avr/avr-fixed.md b/gcc/config/avr/avr-fixed.md index 7d9b525ef6c..b2f0b9aa144 100644 --- a/gcc/config/avr/avr-fixed.md +++ b/gcc/config/avr/avr-fixed.md @@ -447,49 +447,18 @@ ;; "roundqq3_const" "rounduqq3_const" ;; "roundhq3_const" "rounduhq3_const" "roundha3_const" "rounduha3_const" ;; "roundsq3_const" "roundusq3_const" "roundsa3_const" "roundusa3_const" -(define_expand "round3_const" - [(parallel [(match_operand:ALL124QA 0 "register_operand" "") - (match_operand:ALL124QA 1 "register_operand" "") - (match_operand:HI 2 "const_int_operand" "")])] +(define_insn "round3_const" + [(set (match_operand:ALL124QA 0 "register_operand" "=d") + (unspec:ALL124QA [(match_operand:ALL124QA 1 "register_operand" "0") + (match_operand:HI 2 "const_int_operand" "n") + (const_int 0)] + UNSPEC_ROUND))] "" { - // The rounding point RP is $2. The smallest fractional - // bit that is not cleared by the rounding is 2^(-RP). - - enum machine_mode imode = int_mode_for_mode (mode); - int fbit = (int) GET_MODE_FBIT (mode); - - // Add-Saturate 1/2 * 2^(-RP) - - double_int i_add = double_int_zero.set_bit (fbit-1 - INTVAL (operands[2])); - rtx x_add = const_fixed_from_double_int (i_add, mode); - - if (SIGNED_FIXED_POINT_MODE_P (mode)) - emit_move_insn (operands[0], - gen_rtx_SS_PLUS (mode, operands[1], x_add)); - else - emit_move_insn (operands[0], - gen_rtx_US_PLUS (mode, operands[1], x_add)); - - // Keep all bits from RP and higher: ... 2^(-RP) - // Clear all bits from RP+1 and lower: 2^(-RP-1) ... - // Rounding point ^^^^^^^ - // Added above ^^^^^^^^^ - - rtx xreg = simplify_gen_subreg (imode, operands[0], mode, 0); - rtx xmask = immed_double_int_const (-i_add - i_add, imode); - - if (SImode == imode) - emit_insn (gen_andsi3 (xreg, xreg, xmask)); - else if (HImode == imode) - emit_insn (gen_andhi3 (xreg, xreg, xmask)); - else if (QImode == imode) - emit_insn (gen_andqi3 (xreg, xreg, xmask)); - else - gcc_unreachable(); - - DONE; - }) + return avr_out_round (insn, operands); + } + [(set_attr "cc" "clobber") + (set_attr "adjust_len" "round")]) ;; "*roundqq3.libgcc" "*rounduqq3.libgcc" diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 5246d063799..21ad26a6f34 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -86,7 +86,8 @@ extern int avr_starting_frame_offset (void); extern void avr_output_addr_vec_elt (FILE *stream, int value); extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]); extern const char* avr_out_bitop (rtx, rtx*, int*); -extern const char* avr_out_plus (rtx, rtx*, int* =NULL, int* =NULL); +extern const char* avr_out_plus (rtx, rtx*, int* =NULL, int* =NULL, bool =true); +extern const char* avr_out_round (rtx, rtx*, int* =NULL); extern const char* avr_out_addto_sp (rtx*, int*); extern const char* avr_out_xload (rtx, rtx*, int*); extern const char* avr_out_movmem (rtx, rtx*, int*); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 86594e7c208..74872aa6c50 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -6232,11 +6232,14 @@ lshrsi3_out (rtx insn, rtx operands[], int *len) the subtrahend in the original insn, provided it is a compile time constant. In all other cases, SIGN is 0. - Return "". */ + If OUT_LABEL is true, print the final 0: label which is needed for + saturated addition / subtraction. The only case where OUT_LABEL = false + is useful is for saturated addition / subtraction performed during + fixed-point rounding, cf. `avr_out_round'. */ static void avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, - enum rtx_code code_sat = UNKNOWN, int sign = 0) + enum rtx_code code_sat, int sign, bool out_label) { /* MODE of the operation. */ enum machine_mode mode = GET_MODE (xop[0]); @@ -6675,7 +6678,8 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, "mov %r0+5,%0", xop, plen, 4); } - avr_asm_len ("0:", op, plen, 0); + if (out_label) + avr_asm_len ("0:", op, plen, 0); } @@ -6713,8 +6717,8 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) /* Prepare operands of addition/subtraction to be used with avr_out_plus_1. - INSN is a single_set insn with a binary operation as SET_SRC that is - one of: PLUS, SS_PLUS, US_PLUS, MINUS, SS_MINUS, US_MINUS. + INSN is a single_set insn or an insn pattern with a binary operation as + SET_SRC that is one of: PLUS, SS_PLUS, US_PLUS, MINUS, SS_MINUS, US_MINUS. XOP are the operands of INSN. In the case of 64-bit operations with constant XOP[] has just one element: The summand/subtrahend in XOP[0]. @@ -6729,19 +6733,22 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) PLEN and PCC default to NULL. + OUT_LABEL defaults to TRUE. For a description, see AVR_OUT_PLUS_1. + Return "" */ const char* -avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) +avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) { int cc_plus, cc_minus, cc_dummy; int len_plus, len_minus; rtx op[4]; - rtx xdest = SET_DEST (single_set (insn)); + rtx xpattern = INSN_P (insn) ? single_set (insn) : insn; + rtx xdest = SET_DEST (xpattern); enum machine_mode mode = GET_MODE (xdest); enum machine_mode imode = int_mode_for_mode (mode); int n_bytes = GET_MODE_SIZE (mode); - enum rtx_code code_sat = GET_CODE (SET_SRC (single_set (insn))); + enum rtx_code code_sat = GET_CODE (SET_SRC (xpattern)); enum rtx_code code = (PLUS == code_sat || SS_PLUS == code_sat || US_PLUS == code_sat ? PLUS : MINUS); @@ -6756,7 +6763,7 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) if (n_bytes <= 4 && REG_P (xop[2])) { - avr_out_plus_1 (xop, plen, code, pcc, code_sat); + avr_out_plus_1 (xop, plen, code, pcc, code_sat, 0, out_label); return ""; } @@ -6783,7 +6790,8 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) /* Saturations and 64-bit operations don't have a clobber operand. For the other cases, the caller will provide a proper XOP[3]. */ - op[3] = PARALLEL == GET_CODE (PATTERN (insn)) ? xop[3] : NULL_RTX; + xpattern = INSN_P (insn) ? PATTERN (insn) : insn; + op[3] = PARALLEL == GET_CODE (xpattern) ? xop[3] : NULL_RTX; /* Saturation will need the sign of the original operand. */ @@ -6798,8 +6806,8 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) /* Work out the shortest sequence. */ - avr_out_plus_1 (op, &len_minus, MINUS, &cc_plus, code_sat, sign); - avr_out_plus_1 (op, &len_plus, PLUS, &cc_minus, code_sat, sign); + avr_out_plus_1 (op, &len_minus, MINUS, &cc_plus, code_sat, sign, out_label); + avr_out_plus_1 (op, &len_plus, PLUS, &cc_minus, code_sat, sign, out_label); if (plen) { @@ -6807,9 +6815,9 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) *pcc = (len_minus <= len_plus) ? cc_minus : cc_plus; } else if (len_minus <= len_plus) - avr_out_plus_1 (op, NULL, MINUS, pcc, code_sat, sign); + avr_out_plus_1 (op, NULL, MINUS, pcc, code_sat, sign, out_label); else - avr_out_plus_1 (op, NULL, PLUS, pcc, code_sat, sign); + avr_out_plus_1 (op, NULL, PLUS, pcc, code_sat, sign, out_label); return ""; } @@ -6823,13 +6831,15 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc) and return "". If PLEN == NULL, print assembler instructions to perform the operation; otherwise, set *PLEN to the length of the instruction sequence (in words) printed with PLEN == NULL. XOP[3] is either an 8-bit clobber - register or SCRATCH if no clobber register is needed for the operation. */ + register or SCRATCH if no clobber register is needed for the operation. + INSN is an INSN_P or a pattern of an insn. */ const char* avr_out_bitop (rtx insn, rtx *xop, int *plen) { /* CODE and MODE of the operation. */ - enum rtx_code code = GET_CODE (SET_SRC (single_set (insn))); + rtx xpattern = INSN_P (insn) ? single_set (insn) : insn; + enum rtx_code code = GET_CODE (SET_SRC (xpattern)); enum machine_mode mode = GET_MODE (xop[0]); /* Number of bytes to operate on. */ @@ -7332,6 +7342,67 @@ avr_out_fract (rtx insn, rtx operands[], bool intsigned, int *plen) } +/* Output fixed-point rounding. XOP[0] = XOP[1] is the operand to round. + XOP[2] is the rounding point, a CONST_INT. The function prints the + instruction sequence if PLEN = NULL and computes the length in words + of the sequence if PLEN != NULL. Most of this function deals with + preparing operands for calls to `avr_out_plus' and `avr_out_bitop'. */ + +const char* +avr_out_round (rtx insn ATTRIBUTE_UNUSED, rtx *xop, int *plen) +{ + enum machine_mode mode = GET_MODE (xop[0]); + enum machine_mode imode = int_mode_for_mode (mode); + // The smallest fractional bit not cleared by the rounding is 2^(-RP). + int fbit = (int) GET_MODE_FBIT (mode); + double_int i_add = double_int_zero.set_bit (fbit-1 - INTVAL (xop[2])); + // Lengths of PLUS and AND parts. + int len_add = 0, *plen_add = plen ? &len_add : NULL; + int len_and = 0, *plen_and = plen ? &len_and : NULL; + + // Add-Saturate 1/2 * 2^(-RP). Don't print the label "0:" when printing + // the saturated addition so that we can emit the "rjmp 1f" before the + // "0:" below. + + rtx xadd = const_fixed_from_double_int (i_add, mode); + rtx xpattern, xsrc, op[4]; + + xsrc = SIGNED_FIXED_POINT_MODE_P (mode) + ? gen_rtx_SS_PLUS (mode, xop[1], xadd) + : gen_rtx_US_PLUS (mode, xop[1], xadd); + xpattern = gen_rtx_SET (VOIDmode, xop[0], xsrc); + + op[0] = xop[0]; + op[1] = xop[1]; + op[2] = xadd; + avr_out_plus (xpattern, op, plen_add, NULL, false /* Don't print "0:" */); + + avr_asm_len ("rjmp 1f" CR_TAB + "0:", NULL, plen_add, 1); + + // Keep all bits from RP and higher: ... 2^(-RP) + // Clear all bits from RP+1 and lower: 2^(-RP-1) ... + // Rounding point ^^^^^^^ + // Added above ^^^^^^^^^ + rtx xreg = simplify_gen_subreg (imode, xop[0], mode, 0); + rtx xmask = immed_double_int_const (-i_add - i_add, imode); + + xpattern = gen_rtx_SET (VOIDmode, xreg, gen_rtx_AND (imode, xreg, xmask)); + + op[0] = xreg; + op[1] = xreg; + op[2] = xmask; + op[3] = gen_rtx_SCRATCH (QImode); + avr_out_bitop (xpattern, op, plen_and); + avr_asm_len ("1:", NULL, plen, 0); + + if (plen) + *plen = len_add + len_and; + + return ""; +} + + /* Create RTL split patterns for byte sized rotate expressions. This produces a series of move instructions and considers overlap situations. Overlapping non-HImode operands need a scratch register. */ @@ -7540,6 +7611,7 @@ avr_adjust_insn_length (rtx insn, int len) case ADJUST_LEN_SFRACT: avr_out_fract (insn, op, true, &len); break; case ADJUST_LEN_UFRACT: avr_out_fract (insn, op, false, &len); break; + case ADJUST_LEN_ROUND: avr_out_round (insn, op, &len); break; case ADJUST_LEN_TSTHI: avr_out_tsthi (insn, op, &len); break; case ADJUST_LEN_TSTPSI: avr_out_tstpsi (insn, op, &len); break; diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index e9f5d038f1f..f2681233ace 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -140,7 +140,7 @@ "out_bitop, plus, addto_sp, tsthi, tstpsi, tstsi, compare, compare64, call, mov8, mov16, mov24, mov32, reload_in16, reload_in24, reload_in32, - ufract, sfract, + ufract, sfract, round, xload, lpm, movmem, ashlqi, ashrqi, lshrqi, ashlhi, ashrhi, lshrhi, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b60876ae549..e33b35f3b14 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-07-19 Georg-Johann Lay + + Backport from 2013-07-19 trunk r201051. + + PR target/57516 + * gcc.target/avr/torture/builtins-4-roundfx.c (test2hr, test2k): + Adjust to corrected rounding. + 2013-07-19 Kirill Yukhin * gcc.target/i386/bmi-1.c: Extend with new instrinsics. diff --git a/gcc/testsuite/gcc.target/avr/torture/builtins-4-roundfx.c b/gcc/testsuite/gcc.target/avr/torture/builtins-4-roundfx.c index 6ad0775553a..46e915a6c87 100644 --- a/gcc/testsuite/gcc.target/avr/torture/builtins-4-roundfx.c +++ b/gcc/testsuite/gcc.target/avr/torture/builtins-4-roundfx.c @@ -72,11 +72,11 @@ DEFTEST1 (long long accum, llk) static void test2hr (void) { - TEST2 (hr, 1, 0x7f, 0x40); - TEST2 (hr, 2, 0x7f, 0b1100000); - TEST2 (hr, 3, 0x7f, 0b1110000); - TEST2 (hr, 4, 0x7f, 0b1111000); - + TEST2 (hr, 1, 0x7f, 0x7f); + TEST2 (hr, 2, 0x70, 0x7f); + TEST2 (hr, 3, 0x78, 0x7f); + TEST2 (hr, 4, 0x7f, 0x7f); + TEST2 (uhr, 1, 0x7f, 0x80); TEST2 (uhr, 2, 0x7f, 0x80); TEST2 (uhr, 3, 0x7f, 0x80); @@ -85,10 +85,13 @@ static void test2hr (void) void test2k (void) { - TEST2 (k, 1, 0x7fffffff, 0x7fff8000 | 0b100000000000000); - TEST2 (k, 2, 0x7fffffff, 0x7fff8000 | 0b110000000000000); - TEST2 (k, 3, 0x7fffffff, 0x7fff8000 | 0b111000000000000); - TEST2 (k, 4, 0x7fffffff, 0x7fff8000 | 0b111100000000000); + TEST2 (k, 1, 0x7fffff00, 0x7fffffff); + TEST2 (k, 2, 0x7ffffff0, 0x7fffffff); + TEST2 (k, 2, 0x7ffff000, 0x7fffffff); + TEST2 (k, 3, 0x7ffff000, 0x7ffff000); + TEST2 (k, 3, 0x7ffff800, 0x7fffffff); + TEST2 (k, 3, 0x7ffff7ff, 0x7ffff000); + TEST2 (k, 4, 0x7ffff7ff, 0x7ffff800); TEST2 (uk, 1, 0x7fffffff, 1ul << 31); TEST2 (uk, 2, 0x7fffffff, 1ul << 31); diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index a0936c88a1e..39d288739d5 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,13 @@ +2013-07-19 Georg-Johann Lay + + Backport from 2013-07-19 trunk r201051. + + PR target/57516 + * config/avr/lib1funcs-fixed.S (__roundqq3, __rounduqq3) + (__round_s2_const, __round_u2_const) + (__round_s4_const, __round_u4_const, __round_x8): + Saturate result if addition result cannot be represented. + 2013-07-09 Janis Johnson * config.host (powerpc-*-eabispe*): Add t-fdpbit to tmake_file. diff --git a/libgcc/config/avr/lib1funcs-fixed.S b/libgcc/config/avr/lib1funcs-fixed.S index d80389ce2ee..f920891e19e 100644 --- a/libgcc/config/avr/lib1funcs-fixed.S +++ b/libgcc/config/avr/lib1funcs-fixed.S @@ -1464,12 +1464,13 @@ DEFUN __roundqq3 ;; Add-Saturate 2^{-RP-1} add A0, C0 brvc 0f - ldi A0, 0x7f + ldi C0, 0x7f + rjmp 9f 0: ;; Mask out bits beyond RP lsl C0 neg C0 and C0, A0 - mov C1, __tmp_reg__ +9: mov C1, __tmp_reg__ ret ENDF __roundqq3 #endif /* L_roundqq3 */ @@ -1488,12 +1489,13 @@ DEFUN __rounduqq3 ;; Add-Saturate 2^{-RP-1} add A0, C0 brcc 0f - ldi A0, 0xff + ldi C0, 0xff + rjmp 9f 0: ;; Mask out bits beyond RP lsl C0 neg C0 and C0, A0 - mov C1, __tmp_reg__ +9: mov C1, __tmp_reg__ ret ENDF __rounduqq3 #endif /* L_rounduqq3 */ @@ -1565,16 +1567,17 @@ ENDF __rounduha3 DEFUN __round_s2_const brvc 2f - ldi A1, 0x7f + ldi C1, 0x7f rjmp 1f ;; FALLTHRU (Barrier) ENDF __round_s2_const DEFUN __round_u2_const brcc 2f - ldi A1, 0xff + ldi C1, 0xff 1: - ldi A0, 0xff + ldi C0, 0xff + rjmp 9f 2: ;; Saturation is performed now. ;; Currently, we have C[] = 2^{-RP-1} @@ -1586,7 +1589,7 @@ DEFUN __round_u2_const ;; Clear the bits beyond the rounding point. and C0, A0 and C1, A1 - ret +9: ret ENDF __round_u2_const #endif /* L_round_2_const */ @@ -1681,18 +1684,19 @@ ENDF __roundusa3 DEFUN __round_s4_const brvc 2f - ldi A3, 0x7f + ldi C3, 0x7f rjmp 1f ;; FALLTHRU (Barrier) ENDF __round_s4_const DEFUN __round_u4_const brcc 2f - ldi A3, 0xff + ldi C3, 0xff 1: - ldi A2, 0xff - ldi A1, 0xff - ldi A0, 0xff + ldi C2, 0xff + ldi C1, 0xff + ldi C0, 0xff + rjmp 9f 2: ;; Saturation is performed now. ;; Currently, we have C[] = 2^{-RP-1} @@ -1707,7 +1711,7 @@ DEFUN __round_u4_const and C1, A1 and C2, A2 and C3, A3 - ret +9: ret ENDF __round_u4_const #endif /* L_round_4_const */ @@ -1847,12 +1851,13 @@ DEFUN __round_x8 1: ;; Unsigned brcc 3f ;; Unsigned overflow: A[] = 0xff... -2: ldi A7, 0xff - ldi A6, 0xff - wmov A0, A6 - wmov A2, A6 - wmov A4, A6 - bld A7, 7 +2: ldi C7, 0xff + ldi C6, 0xff + wmov C0, C6 + wmov C2, C6 + wmov C4, C6 + bld C7, 7 + rjmp 9f 3: ;; C[] = -C[] - C[] push A0 @@ -1869,7 +1874,7 @@ DEFUN __round_x8 and C5, A5 and C6, A6 and C7, A7 - ;; Epilogue +9: ;; Epilogue pop r29 pop r28 pop r17 -- cgit v1.2.3 From 2b19672d82041ee6ea8a6839f378a885fe239448 Mon Sep 17 00:00:00 2001 From: Wei Mi Date: Fri, 19 Jul 2013 20:47:57 +0000 Subject: 2013-07-19 Wei Mi Backport from mainline: gcc/ 2013-07-18 Vladimir Makarov Wei Mi PR rtl-optimization/57878 * lra-assigns.c (assign_by_spills): Move non_reload_pseudos to the top. Promote lra_assert to gcc_assert. (reload_pseudo_compare_func): Check regs first for reload pseudos. gcc/testsuite/ 2013-07-18 Wei Mi PR rtl-optimization/57878 * g++.dg/pr57518.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201068 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 ++ gcc/lra-assigns.c | 17 +++- gcc/testsuite/ChangeLog | 8 ++ gcc/testsuite/g++.dg/pr57878.C | 226 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr57878.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6277bf79ba..374a885619a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-07-19 Wei Mi + + Backport from mainline: + 2013-07-18 Vladimir Makarov + Wei Mi + + PR rtl-optimization/57878 + * lra-assigns.c (assign_by_spills): Move non_reload_pseudos to the + top. Promote lra_assert to gcc_assert. + (reload_pseudo_compare_func): Check regs first for reload pseudos. + 2013-07-11 Georg-Johann Lay Backport from 2013-07-19 trunk r201051. diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index b2045138b91..bb18c68cc5a 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -116,6 +116,11 @@ struct regno_assign_info /* Map regno to the corresponding regno assignment info. */ static struct regno_assign_info *regno_assign_info; +/* All inherited, subreg or optional pseudos created before last spill + sub-pass. Such pseudos are permitted to get memory instead of hard + regs. */ +static bitmap_head non_reload_pseudos; + /* Process a pseudo copy with execution frequency COPY_FREQ connecting REGNO1 and REGNO2 to form threads. */ static void @@ -194,6 +199,15 @@ reload_pseudo_compare_func (const void *v1p, const void *v2p) if ((diff = (ira_class_hard_regs_num[cl1] - ira_class_hard_regs_num[cl2])) != 0) return diff; + if ((diff + = (ira_reg_class_max_nregs[cl2][lra_reg_info[r2].biggest_mode] + - ira_reg_class_max_nregs[cl1][lra_reg_info[r1].biggest_mode])) != 0 + /* The code below executes rarely as nregs == 1 in most cases. + So we should not worry about using faster data structures to + check reload pseudos. */ + && ! bitmap_bit_p (&non_reload_pseudos, r1) + && ! bitmap_bit_p (&non_reload_pseudos, r2)) + return diff; if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq - regno_assign_info[regno_assign_info[r1].first].freq)) != 0) return diff; @@ -1156,7 +1170,6 @@ assign_by_spills (void) rtx insn; basic_block bb; bitmap_head changed_insns, do_not_assign_nonreload_pseudos; - bitmap_head non_reload_pseudos; unsigned int u; bitmap_iterator bi; bool reload_p; @@ -1265,7 +1278,7 @@ assign_by_spills (void) } } } - lra_assert (asm_p); + gcc_assert (asm_p); break; } /* This is a very rare event. We can not assign a hard diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e33b35f3b14..183bdaef6ba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-07-19 Wei Mi + + Backport from mainline: + 2013-07-18 Wei Mi + + PR rtl-optimization/57878 + * g++.dg/pr57518.C: New test. + 2013-07-19 Georg-Johann Lay Backport from 2013-07-19 trunk r201051. diff --git a/gcc/testsuite/g++.dg/pr57878.C b/gcc/testsuite/g++.dg/pr57878.C new file mode 100644 index 00000000000..b1aa25c486c --- /dev/null +++ b/gcc/testsuite/g++.dg/pr57878.C @@ -0,0 +1,226 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-m32 -O2 -fno-omit-frame-pointer -fPIC -std=gnu++11" } */ + +typedef int int32; +typedef long long int64; +typedef unsigned int uint32; +typedef unsigned long long uint64; +namespace std { + typedef unsigned int size_t; + template + struct char_traits; + template + inline _Tp* __addressof(_Tp& __r) noexcept { + return reinterpret_cast<_Tp*> (&const_cast(reinterpret_cast(__r))); + } + template + struct remove_reference { + typedef _Tp type; + }; + template + constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { + return static_cast<_Tp&&>(__t); + } +} +typedef unsigned int size_t; +extern "C++" { + inline void* operator new(std::size_t, void* __p) noexcept { + return __p; + } +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template + class new_allocator { + public: + typedef size_t size_type; + typedef _Tp* pointer; + }; +} +namespace std { + template + using __allocator_base = __gnu_cxx::new_allocator<_Tp>; + template + class allocator + : public __allocator_base<_Tp> { + public: + typedef size_t size_type; + template + struct rebind { + typedef allocator<_Tp1> other; + }; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template + class __sso_string_base; + template, typename _Alloc = std::allocator<_CharT>, template class _Base = __sso_string_base> + class __versa_string; + template + struct __vstring_utility { + typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; + template + struct _Alloc_hider + : public _Alloc1 { + _Alloc_hider(const _Alloc1& __a, _CharT* __ptr) + : _Alloc1(__a), _M_p(__ptr) { + } + _CharT* _M_p; + }; + }; + template + class __sso_string_base + : protected __vstring_utility<_CharT, _Traits, _Alloc> { + typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base; + typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type; + typedef typename _CharT_alloc_type::size_type size_type; + private: + typename _Util_Base::template _Alloc_hider<_CharT_alloc_type> + _M_dataplus; + size_type _M_string_length; + enum { + _S_local_capacity = 15 }; + union { + _CharT _M_local_data[_S_local_capacity + 1]; + }; + template + void _M_construct(_InIterator __beg, _InIterator __end); + public: + size_type _M_max_size() const; + _CharT* _M_data() const { + return _M_dataplus._M_p; + } + size_type _M_length() const { + return _M_string_length; + } + __sso_string_base(const __sso_string_base& __rcs); + const _CharT_alloc_type& _M_get_allocator() const { + } + }; + template + __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const __sso_string_base& __rcs) + : _M_dataplus(__rcs._M_get_allocator(), _M_local_data) { + _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); + } + template class _Base> + class __versa_string + : private _Base<_CharT, _Traits, _Alloc> { + }; +} +template, typename _Alloc = std::allocator<_CharT> > +class basic_string + : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> { +}; +typedef basic_string string; +namespace std __attribute__ ((__visibility__ ("default"))) { + template + class __alloctr_rebind_helper { + public: + static const bool __value = true; + }; + template::__value> + struct __alloctr_rebind; + template struct __alloctr_rebind<_Alloc, _Tp, true> + { + typedef typename _Alloc::template rebind<_Tp>::other __type; + }; + template + struct allocator_traits { + private: + template + static typename _Tp::pointer _S_pointer_helper(_Tp*); + typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer; + public: + typedef __pointer pointer; + template + using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type; + }; +} +namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) { + template struct __alloc_traits + : std::allocator_traits<_Alloc> + { + typedef std::allocator_traits<_Alloc> _Base_type; + template + struct rebind { + typedef typename _Base_type::template rebind_alloc<_Tp> + other; + }; + }; +} +namespace std __attribute__ ((__visibility__ ("default"))) { + template + inline void _Construct(_T1* __p, _Args&&... __args) { + ::new(static_cast(__p)) _T1(std::forward<_Args>(__args)...); + } + template + struct _Vector_base { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer; + struct _Vector_impl + : public _Tp_alloc_type { + pointer _M_start; + pointer _M_finish; + }; + public: + _Vector_impl _M_impl; + }; + template > + class vector + : protected _Vector_base<_Tp, _Alloc> { + typedef _Vector_base<_Tp, _Alloc> _Base; + public: + typedef _Tp value_type; + typedef typename _Base::pointer pointer; + typedef size_t size_type; + size_type size() const; + void push_back(const value_type& __x) { + _M_emplace_back_aux(__x); + } + template + void _M_emplace_back_aux(_Args&&... __args); + size_type _M_check_len(); + }; + template template + void vector<_Tp, _Alloc>:: _M_emplace_back_aux(_Args&&... __args) { + const size_type __len = _M_check_len(); + pointer __new_start(static_cast(::operator new(__len * sizeof(_Tp)))); + pointer __new_temp(__new_start + size()); + ::new((void *)__new_temp) _Tp(std::forward<_Args>(__args)...); + pointer __cur = __new_start; + pointer __first = this->_M_impl._M_start; + pointer __last = this->_M_impl._M_finish; + for (; + __first != __last; + ++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first); + } +} +using std::vector; +class DL { +public: + struct ChunkId { + int64 disk_id; + uint64 handle; + uint64 version; + string capability; + ChunkId(); + }; + struct ChunkInfo { + ChunkId id; + uint64 mtime; + uint32 length; + int32 space_used; + }; +}; +class FDB { + void CollectChunk(const DL::ChunkInfo& chunk, const int& location); +private: + struct ChunkData { + int location; + DL::ChunkInfo chunk_info; + }; + vector chunk_data_; +}; +void FDB::CollectChunk(const DL::ChunkInfo& chunk, const int& location) { + ChunkData chunk_data; + chunk_data_.push_back( chunk_data); +} -- cgit v1.2.3 From df3bedc5a034d7227c7497b858d8be7e1834cbcc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 20 Jul 2013 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201077 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5edd869d535..1b631cf1aea 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130719 +20130720 -- cgit v1.2.3 From 7d308f0bfce758db2de8be6d14fcf3deaf49b819 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 21 Jul 2013 00:16:18 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201089 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1b631cf1aea..6ec51564b99 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130720 +20130721 -- cgit v1.2.3 From ab1c09dee2b8fa042f91197dda6e0002636b4924 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 22 Jul 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201115 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6ec51564b99..a4b77a02239 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130721 +20130722 -- cgit v1.2.3 From 88d7d241e9e41fddc64cd5df1be6d7529bcd79ed Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Mon, 22 Jul 2013 08:57:41 +0000 Subject: gcc/ Backport from mainline: 2013-07-22 Uros Bizjak * config/i386/i386.md (nonlocal_goto_receiver): Delete insn if it is not needed after split. 2013-07-20 Iain Sandoe PR target/51784 * config/i386/i386.c (output_set_got) [TARGET_MACHO]: Adjust to emit a second label for nonlocal goto receivers. Don't output pic base labels unless we're producing PIC; mark that action unreachable(). (ix86_save_reg): If the function contains a nonlocal label, save the PIC base reg. * config/darwin-protos.h (machopic_should_output_picbase_label): New. * gcc/config/darwin.c (emitted_pic_label_num): New GTY. (update_pic_label_number_if_needed): New. (machopic_output_function_base_name): Adjust for nonlocal receiver case. (machopic_should_output_picbase_label): New. * config/i386/i386.md (enum unspecv): UNSPECV_NLGR: New. (nonlocal_goto_receiver): New insn and split. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201120 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 +++++++++++++++++++++++++ gcc/config/darwin-protos.h | 1 + gcc/config/darwin.c | 30 +++++++++++++++++++++++++----- gcc/config/i386/i386.c | 30 ++++++++++++++++-------------- gcc/config/i386/i386.md | 34 +++++++++++++++++++++++++++++++++- 5 files changed, 100 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 374a885619a..ede48774278 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2013-07-22 Iain Sandoe + + Backport from mainline: + 2013-07-22 Uros Bizjak + + * config/i386/i386.md (nonlocal_goto_receiver): Delete insn if + it is not needed after split. + + 2013-07-20 Iain Sandoe + + PR target/51784 + * config/i386/i386.c (output_set_got) [TARGET_MACHO]: Adjust to emit a + second label for nonlocal goto receivers. Don't output pic base labels + unless we're producing PIC; mark that action unreachable(). + (ix86_save_reg): If the function contains a nonlocal label, save the + PIC base reg. + * config/darwin-protos.h (machopic_should_output_picbase_label): New. + * gcc/config/darwin.c (emitted_pic_label_num): New GTY. + (update_pic_label_number_if_needed): New. + (machopic_output_function_base_name): Adjust for nonlocal receiver + case. + (machopic_should_output_picbase_label): New. + * config/i386/i386.md (enum unspecv): UNSPECV_NLGR: New. + (nonlocal_goto_receiver): New insn and split. + 2013-07-19 Wei Mi Backport from mainline: diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index 0755e94692a..70b7fb00959 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -25,6 +25,7 @@ extern void machopic_validate_stub_or_non_lazy_ptr (const char *); extern void machopic_output_function_base_name (FILE *); extern const char *machopic_indirection_name (rtx, bool); extern const char *machopic_mcount_stub_name (void); +extern bool machopic_should_output_picbase_label (void); #ifdef RTX_CODE diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index a049a5d0796..e07fa4c8324 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -369,14 +369,13 @@ machopic_gen_offset (rtx orig) static GTY(()) const char * function_base_func_name; static GTY(()) int current_pic_label_num; +static GTY(()) int emitted_pic_label_num; -void -machopic_output_function_base_name (FILE *file) +static void +update_pic_label_number_if_needed (void) { const char *current_name; - /* If dynamic-no-pic is on, we should not get here. */ - gcc_assert (!MACHO_DYNAMIC_NO_PIC_P); /* When we are generating _get_pc thunks within stubs, there is no current function. */ if (current_function_decl) @@ -394,7 +393,28 @@ machopic_output_function_base_name (FILE *file) ++current_pic_label_num; function_base_func_name = "L_machopic_stub_dummy"; } - fprintf (file, "L%011d$pb", current_pic_label_num); +} + +void +machopic_output_function_base_name (FILE *file) +{ + /* If dynamic-no-pic is on, we should not get here. */ + gcc_assert (!MACHO_DYNAMIC_NO_PIC_P); + + update_pic_label_number_if_needed (); + fprintf (file, "L%d$pb", current_pic_label_num); +} + +bool +machopic_should_output_picbase_label (void) +{ + update_pic_label_number_if_needed (); + + if (current_pic_label_num == emitted_pic_label_num) + return false; + + emitted_pic_label_num = current_pic_label_num; + return true; } /* The suffix attached to non-lazy pointer symbols. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 858dda3d75d..954fc258a88 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8721,17 +8721,12 @@ output_set_got (rtx dest, rtx label ATTRIBUTE_UNUSED) if (!flag_pic) { - xops[2] = gen_rtx_LABEL_REF (Pmode, label ? label : gen_label_rtx ()); + if (TARGET_MACHO) + /* We don't need a pic base, we're not producing pic. */ + gcc_unreachable (); + xops[2] = gen_rtx_LABEL_REF (Pmode, label ? label : gen_label_rtx ()); output_asm_insn ("mov%z0\t{%2, %0|%0, %2}", xops); - -#if TARGET_MACHO - /* Output the Mach-O "canonical" label name ("Lxx$pb") here too. This - is what will be referenced by the Mach-O PIC subsystem. */ - if (!label) - ASM_OUTPUT_LABEL (asm_out_file, MACHOPIC_FUNCTION_BASE_NAME); -#endif - targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (XEXP (xops[2], 0))); } @@ -8744,12 +8739,18 @@ output_set_got (rtx dest, rtx label ATTRIBUTE_UNUSED) xops[2] = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (name)); xops[2] = gen_rtx_MEM (QImode, xops[2]); output_asm_insn ("call\t%X2", xops); - /* Output the Mach-O "canonical" label name ("Lxx$pb") here too. This - is what will be referenced by the Mach-O PIC subsystem. */ + #if TARGET_MACHO - if (!label) + /* Output the Mach-O "canonical" pic base label name ("Lxx$pb") here. + This is what will be referenced by the Mach-O PIC subsystem. */ + if (machopic_should_output_picbase_label () || !label) ASM_OUTPUT_LABEL (asm_out_file, MACHOPIC_FUNCTION_BASE_NAME); - else + + /* When we are restoring the pic base at the site of a nonlocal label, + and we decided to emit the pic base above, we will still output a + local label used for calculating the correction offset (even though + the offset will be 0 in that case). */ + if (label) targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (label)); #endif @@ -8831,7 +8832,8 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return) && (df_regs_ever_live_p (REAL_PIC_OFFSET_TABLE_REGNUM) || crtl->profile || crtl->calls_eh_return - || crtl->uses_const_pool)) + || crtl->uses_const_pool + || cfun->has_nonlocal_label)) return ix86_select_alt_pic_regnum () == INVALID_REGNUM; if (crtl->calls_eh_return && maybe_eh_return) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 047076fc917..57e0dcacdc0 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -222,6 +222,8 @@ UNSPECV_XEND UNSPECV_XABORT UNSPECV_XTEST + + UNSPECV_NLGR ]) ;; Constants to represent rounding modes in the ROUND instruction @@ -16646,7 +16648,37 @@ emit_insn (gen_set_got (pic_offset_table_rtx)); DONE; }) - + +(define_insn_and_split "nonlocal_goto_receiver" + [(unspec_volatile [(const_int 0)] UNSPECV_NLGR)] + "TARGET_MACHO && !TARGET_64BIT && flag_pic" + "#" + "&& reload_completed" + [(const_int 0)] +{ + if (crtl->uses_pic_offset_table) + { + rtx xops[3]; + rtx label_rtx = gen_label_rtx (); + rtx tmp; + + /* Get a new pic base. */ + emit_insn (gen_set_got_labelled (pic_offset_table_rtx, label_rtx)); + /* Correct this with the offset from the new to the old. */ + xops[0] = xops[1] = pic_offset_table_rtx; + label_rtx = gen_rtx_LABEL_REF (SImode, label_rtx); + tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, label_rtx), + UNSPEC_MACHOPIC_OFFSET); + xops[2] = gen_rtx_CONST (Pmode, tmp); + ix86_expand_binary_operator (MINUS, SImode, xops); + } + else + /* No pic reg restore needed. */ + emit_note (NOTE_INSN_DELETED); + + DONE; +}) + ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode. (define_split -- cgit v1.2.3 From 44c43319bf7a8396a07489ca38a7f3f5a82e6cff Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 23 Jul 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201151 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a4b77a02239..d34cb4f2882 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130722 +20130723 -- cgit v1.2.3 From 78d21b807e9a8607967eb5762e72d28b8269f9a9 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Jul 2013 04:42:18 +0000 Subject: runtime: Ignore SIGPROF if not on a Go thread. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201155 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-signal.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 1e800578ffa..9771b71cfcf 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -166,21 +166,22 @@ runtime_sighandler (int sig, Siginfo *info, int i; m = runtime_m (); - if (m == NULL) - { - runtime_badsignal (sig); - return; - } #ifdef SIGPROF if (sig == SIGPROF) { - if (gp != runtime_m ()->g0 && gp != runtime_m ()->gsignal) + if (m != NULL && gp != m->g0 && gp != m->gsignal) runtime_sigprof (); return; } #endif + if (m == NULL) + { + runtime_badsignal (sig); + return; + } + for (i = 0; runtime_sigtab[i].sig != -1; ++i) { SigTab *t; -- cgit v1.2.3 From d3bf013c1357c221dd20ac5cc03fba04d8dac881 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Jul 2013 20:26:30 +0000 Subject: runtime: Support cgo callbacks from threads started by C. This adjusts the extram support to work with gccgo. There are some corresponding changes to cgo in https://codereview.appspot.com/11406047/ . git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201180 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-cgo.c | 28 ++++++++++++++ libgo/runtime/go-defer.c | 10 ++++- libgo/runtime/go-panic.c | 10 ++++- libgo/runtime/proc.c | 99 +++++++++++++++++++++++++++++++++++++++--------- libgo/runtime/runtime.h | 4 ++ 5 files changed, 131 insertions(+), 20 deletions(-) diff --git a/libgo/runtime/go-cgo.c b/libgo/runtime/go-cgo.c index 46eb1827a93..9ba1ea7d042 100644 --- a/libgo/runtime/go-cgo.c +++ b/libgo/runtime/go-cgo.c @@ -35,6 +35,9 @@ syscall_cgocall () M* m; G* g; + if (runtime_needextram && runtime_cas (&runtime_needextram, 1, 0)) + runtime_newextram (); + m = runtime_m (); ++m->ncgocall; g = runtime_g (); @@ -71,7 +74,24 @@ syscall_cgocalldone () void syscall_cgocallback () { + M *mp; + + mp = runtime_m (); + if (mp == NULL) + { + runtime_needm (); + mp = runtime_m (); + mp->dropextram = true; + } + runtime_exitsyscall (); + + mp = runtime_m (); + if (mp->needextram) + { + mp->needextram = 0; + runtime_newextram (); + } } /* Prepare to return to C/C++ code from a callback to Go code. */ @@ -79,7 +99,15 @@ syscall_cgocallback () void syscall_cgocallbackdone () { + M *mp; + runtime_entersyscall (); + mp = runtime_m (); + if (mp->dropextram && runtime_g ()->ncgo == 0) + { + mp->dropextram = false; + runtime_dropm (); + } } /* Allocate memory and save it in a list visible to the Go garbage diff --git a/libgo/runtime/go-defer.c b/libgo/runtime/go-defer.c index c27de6ab463..3955e0f5cee 100644 --- a/libgo/runtime/go-defer.c +++ b/libgo/runtime/go-defer.c @@ -42,6 +42,7 @@ __go_undefer (_Bool *frame) { struct __go_defer_stack *d; void (*pfn) (void *); + M *m; d = g->defer; pfn = d->__pfn; @@ -51,7 +52,14 @@ __go_undefer (_Bool *frame) (*pfn) (d->__arg); g->defer = d->__next; - __go_free (d); + + /* This may be called by a cgo callback routine to defer the + call to syscall.CgocallBackDone, in which case we will not + have a memory context. Don't try to free anything in that + case--the GC will release it later. */ + m = runtime_m (); + if (m != NULL && m->mcache != NULL) + __go_free (d); /* Since we are executing a defer function here, we know we are returning from the calling function. If the calling diff --git a/libgo/runtime/go-panic.c b/libgo/runtime/go-panic.c index 530629ca339..7e284eeaa3d 100644 --- a/libgo/runtime/go-panic.c +++ b/libgo/runtime/go-panic.c @@ -54,6 +54,7 @@ __go_panic (struct __go_empty_interface arg) { struct __go_defer_stack *d; void (*pfn) (void *); + M *m; d = g->defer; if (d == NULL) @@ -95,7 +96,14 @@ __go_panic (struct __go_empty_interface arg) } g->defer = d->__next; - __go_free (d); + + /* This may be called by a cgo callback routine to defer the + call to syscall.CgocallBackDone, in which case we will not + have a memory context. Don't try to free anything in that + case--the GC will release it later. */ + m = runtime_m (); + if (m != NULL && m->mcache != NULL) + __go_free (d); } /* The panic was not recovered. */ diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index d1f277a8bc8..d42ff3362ee 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -397,7 +397,8 @@ enum { MaxGomaxprocs = 1<<8 }; Sched runtime_sched; int32 runtime_gomaxprocs; bool runtime_singleproc; -bool runtime_iscgo; +bool runtime_iscgo = true; +uint32 runtime_needextram = 1; uint32 runtime_gcwaiting; M runtime_m0; G runtime_g0; // idle goroutine for m0 @@ -901,8 +902,8 @@ runtime_mstart(void* mp) #ifdef USING_SPLIT_STACK { - int dont_block_signals = 0; - __splitstack_block_signals(&dont_block_signals, nil); + int dont_block_signals = 0; + __splitstack_block_signals(&dont_block_signals, nil); } #endif @@ -944,7 +945,7 @@ struct CgoThreadStart // Allocate a new m unassociated with any thread. // Can use p for allocation context if needed. M* -runtime_allocm(P *p) +runtime_allocm(P *p, int32 stacksize, byte** ret_g0_stack, size_t* ret_g0_stacksize) { M *mp; @@ -961,7 +962,7 @@ runtime_allocm(P *p) mp = runtime_mal(sizeof *mp); mcommoninit(mp); - mp->g0 = runtime_malg(-1, nil, nil); + mp->g0 = runtime_malg(stacksize, ret_g0_stack, ret_g0_stacksize); if(p == m->p) releasep(); @@ -1006,6 +1007,9 @@ static void unlockextra(M*); // // When the callback is done with the m, it calls dropm to // put the m back on the list. +// +// Unlike the gc toolchain, we start running on curg, since we are +// just going to return and let the caller continue. void runtime_needm(void) { @@ -1027,18 +1031,40 @@ runtime_needm(void) mp->needextram = mp->schedlink == nil; unlockextra(mp->schedlink); - // Install m and g (= m->g0) and set the stack bounds - // to match the current stack. We don't actually know - // how big the stack is, like we don't know how big any - // scheduling stack is, but we assume there's at least 32 kB, - // which is more than enough for us. - runtime_setmg(mp, mp->g0); + // Install m and g (= m->curg). + runtime_setmg(mp, mp->curg); - // We assume that the split stack support has been initialized - // for this new thread. + // Initialize g's context as in mstart. + initcontext(); + g->status = Gsyscall; + g->entry = nil; + g->param = nil; +#ifdef USING_SPLIT_STACK + __splitstack_getcontext(&g->stack_context[0]); +#else + g->gcinitial_sp = ∓ + g->gcstack_size = 0; + g->gcnext_sp = ∓ +#endif + getcontext(&g->context); + + if(g->entry != nil) { + // Got here from mcall. + void (*pfn)(G*) = (void (*)(G*))g->entry; + G* gp = (G*)g->param; + pfn(gp); + *(int*)0x22 = 0x22; + } // Initialize this thread to use the m. runtime_minit(); + +#ifdef USING_SPLIT_STACK + { + int dont_block_signals = 0; + __splitstack_block_signals(&dont_block_signals, nil); + } +#endif } // newextram allocates an m and puts it on the extra list. @@ -1049,15 +1075,17 @@ runtime_newextram(void) { M *mp, *mnext; G *gp; + byte *g0_sp, *sp; + size_t g0_spsize, spsize; // Create extra goroutine locked to extra m. // The goroutine is the context in which the cgo callback will run. // The sched.pc will never be returned to, but setting it to // runtime.goexit makes clear to the traceback routines where // the goroutine stack ends. - mp = runtime_allocm(nil); - gp = runtime_malg(StackMin, nil, nil); - gp->status = Gsyscall; + mp = runtime_allocm(nil, StackMin, &g0_sp, &g0_spsize); + gp = runtime_malg(StackMin, &sp, &spsize); + gp->status = Gdead; mp->curg = gp; mp->locked = LockInternal; mp->lockedg = gp; @@ -1072,6 +1100,16 @@ runtime_newextram(void) runtime_unlock(&runtime_sched); gp->goid = runtime_xadd64(&runtime_sched.goidgen, 1); + // The context for gp will be set up in runtime_needm. But + // here we need to set up the context for g0. + getcontext(&mp->g0->context); + mp->g0->context.uc_stack.ss_sp = g0_sp; +#ifdef MAKECONTEXT_STACK_TOP + mp->g0->context.uc_stack.ss_sp += g0_spsize; +#endif + mp->g0->context.uc_stack.ss_size = g0_spsize; + makecontext(&mp->g0->context, kickoff, 0); + // Add m to the extra list. mnext = lockextra(true); mp->schedlink = mnext; @@ -1114,6 +1152,8 @@ runtime_dropm(void) mp = m; runtime_setmg(nil, nil); + mp->curg->status = Gdead; + mnext = lockextra(true); mp->schedlink = mnext; unlockextra(mp); @@ -1159,6 +1199,29 @@ unlockextra(M *mp) runtime_atomicstorep(&runtime_extram, mp); } +static int32 +countextra() +{ + M *mp, *mc; + int32 c; + + for(;;) { + mp = runtime_atomicloadp(&runtime_extram); + if(mp == MLOCKED) { + runtime_osyield(); + continue; + } + if(!runtime_casp(&runtime_extram, mp, MLOCKED)) { + runtime_osyield(); + continue; + } + c = 0; + for(mc = mp; mc != nil; mc = mc->schedlink) + c++; + runtime_atomicstorep(&runtime_extram, mp); + return c; + } +} // Create a new m. It will start off with a call to fn, or else the scheduler. static void @@ -1166,7 +1229,7 @@ newm(void(*fn)(void), P *p) { M *mp; - mp = runtime_allocm(p); + mp = runtime_allocm(p, -1, nil, nil); mp->nextp = p; mp->mstartfn = fn; @@ -2348,7 +2411,7 @@ checkdead(void) int32 run, grunning, s; // -1 for sysmon - run = runtime_sched.mcount - runtime_sched.nmidle - runtime_sched.mlocked - 1; + run = runtime_sched.mcount - runtime_sched.nmidle - runtime_sched.mlocked - 1 - countextra(); if(run > 0) return; if(run < 0) { diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 5b2a64f5110..78fd388186a 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -273,6 +273,7 @@ struct M GCStats gcstats; bool racecall; bool needextram; + bool dropextram; // for gccgo: drop after call is done. void* racepc; void (*waitunlockf)(Lock*); void* waitlock; @@ -450,6 +451,7 @@ extern G* runtime_lastg; extern M* runtime_allm; extern P** runtime_allp; extern int32 runtime_gomaxprocs; +extern uint32 runtime_needextram; extern bool runtime_singleproc; extern uint32 runtime_panicking; extern uint32 runtime_gcwaiting; // gc is waiting to run @@ -518,6 +520,8 @@ G* runtime_malg(int32, byte**, size_t*); void runtime_mpreinit(M*); void runtime_minit(void); void runtime_unminit(void); +void runtime_needm(void); +void runtime_dropm(void); void runtime_signalstack(byte*, int32); MCache* runtime_allocmcache(void); void runtime_freemcache(MCache*); -- cgit v1.2.3 From 02a15a70db75e2f724e443e6a0f57d93b9e6eab7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Jul 2013 20:32:35 +0000 Subject: runtime: Declare epoll_create1 if necessary. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201182 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/netpoll_epoll.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libgo/runtime/netpoll_epoll.c b/libgo/runtime/netpoll_epoll.c index 04f9c756472..98c5cbeb587 100644 --- a/libgo/runtime/netpoll_epoll.c +++ b/libgo/runtime/netpoll_epoll.c @@ -20,6 +20,10 @@ #define EPOLL_CLOEXEC 02000000 #endif +#ifndef HAVE_EPOLL_CREATE1 +extern int epoll_create1(int __flags); +#endif + typedef struct epoll_event EpollEvent; static int32 -- cgit v1.2.3 From 68a24e347bb608f3b2796b20d5ef3509cacf37a1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Jul 2013 20:39:05 +0000 Subject: net: Remove Solaris-specific version of listenerSockaddr. Solaris will use the version in sock_unix.go. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201184 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/net/sock_solaris.go | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/libgo/go/net/sock_solaris.go b/libgo/go/net/sock_solaris.go index ad639cc4a7f..484e1fe461a 100644 --- a/libgo/go/net/sock_solaris.go +++ b/libgo/go/net/sock_solaris.go @@ -16,32 +16,3 @@ func maxListenerBacklog() int { // The kernel does not track the limit. return syscall.SOMAXCONN } - -func listenerSockaddr(s, f int, la syscall.Sockaddr, toAddr func(syscall.Sockaddr) Addr) (syscall.Sockaddr, error) { - a := toAddr(la) - if a == nil { - return la, nil - } - switch v := a.(type) { - case *TCPAddr, *UnixAddr: - err := setDefaultListenerSockopts(s) - if err != nil { - return nil, err - } - case *UDPAddr: - if v.IP.IsMulticast() { - err := setDefaultMulticastSockopts(s) - if err != nil { - return nil, err - } - switch f { - case syscall.AF_INET: - v.IP = IPv4zero - case syscall.AF_INET6: - v.IP = IPv6unspecified - } - return v.sockaddr(f) - } - } - return la, nil -} -- cgit v1.2.3 From 049ae5995c3befd2bce9a6fee80de595e62fa513 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 23 Jul 2013 21:23:47 +0000 Subject: log/syslog: Restore interface to make this work on Solaris again. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201189 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/log/syslog/syslog.go | 32 +++++++++++++++++++++++++------- libgo/go/log/syslog/syslog_libc.go | 8 ++++---- libgo/go/log/syslog/syslog_unix.go | 4 ++-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/libgo/go/log/syslog/syslog.go b/libgo/go/log/syslog/syslog.go index 8bdd9825e1c..20acab8ffc0 100644 --- a/libgo/go/log/syslog/syslog.go +++ b/libgo/go/log/syslog/syslog.go @@ -88,6 +88,15 @@ type Writer struct { raddr string mu sync.Mutex // guards conn + conn serverConn +} + +type serverConn interface { + writeString(p Priority, hostname, tag, s, nl string) error + close() error +} + +type netConn struct { conn net.Conn } @@ -135,7 +144,7 @@ func Dial(network, raddr string, priority Priority, tag string) (*Writer, error) func (w *Writer) connect() (err error) { if w.conn != nil { // ignore err from close, it makes sense to continue anyway - w.conn.Close() + w.conn.close() w.conn = nil } @@ -148,7 +157,7 @@ func (w *Writer) connect() (err error) { var c net.Conn c, err = net.Dial(w.network, w.raddr) if err == nil { - w.conn = c + w.conn = netConn{c} if w.hostname == "" { w.hostname = c.LocalAddr().String() } @@ -168,7 +177,7 @@ func (w *Writer) Close() error { defer w.mu.Unlock() if w.conn != nil { - err := w.conn.Close() + err := w.conn.close() w.conn = nil return err } @@ -257,13 +266,22 @@ func (w *Writer) write(p Priority, msg string) (int, error) { nl = "\n" } - timestamp := time.Now().Format(time.RFC3339) - fmt.Fprintf(w.conn, "<%d>%s %s %s[%d]: %s%s", - p, timestamp, w.hostname, - w.tag, os.Getpid(), msg, nl) + w.conn.writeString(p, w.hostname, w.tag, msg, nl) return len(msg), nil } +func (n netConn) writeString(p Priority, hostname, tag, msg, nl string) error { + timestamp := time.Now().Format(time.RFC3339) + _, err := fmt.Fprintf(n.conn, "<%d>%s %s %s[%d]: %s%s", + p, timestamp, hostname, + tag, os.Getpid(), msg, nl) + return err +} + +func (n netConn) close() error { + return n.conn.Close() +} + // NewLogger creates a log.Logger whose output is written to // the system log service with the specified priority. The logFlag // argument is the flag set passed through to log.New to create diff --git a/libgo/go/log/syslog/syslog_libc.go b/libgo/go/log/syslog/syslog_libc.go index 2d14d5d20a8..cf370eff9d7 100644 --- a/libgo/go/log/syslog/syslog_libc.go +++ b/libgo/go/log/syslog/syslog_libc.go @@ -23,17 +23,17 @@ type libcConn int func syslog_c(int, *byte) -func (libcConn) writeString(p Priority, hostname, tag, msg string) (int, error) { +func (libcConn) writeString(p Priority, hostname, tag, msg, nl string) error { timestamp := time.Now().Format(time.RFC3339) - log := fmt.Sprintf("%s %s %s[%d]: %s", timestamp, hostname, tag, os.Getpid(), msg) + log := fmt.Sprintf("%s %s %s[%d]: %s%s", timestamp, hostname, tag, os.Getpid(), msg, nl) buf, err := syscall.BytePtrFromString(log) if err != nil { - return 0, err + return err } syscall.Entersyscall() syslog_c(int(p), buf) syscall.Exitsyscall() - return len(msg), nil + return nil } func (libcConn) close() error { diff --git a/libgo/go/log/syslog/syslog_unix.go b/libgo/go/log/syslog/syslog_unix.go index a0001ccaea9..1716d60feaa 100644 --- a/libgo/go/log/syslog/syslog_unix.go +++ b/libgo/go/log/syslog/syslog_unix.go @@ -14,7 +14,7 @@ import ( // unixSyslog opens a connection to the syslog daemon running on the // local machine using a Unix domain socket. -func unixSyslog() (conn net.Conn, err error) { +func unixSyslog() (conn serverConn, err error) { logTypes := []string{"unixgram", "unix"} logPaths := []string{"/dev/log", "/var/run/syslog"} for _, network := range logTypes { @@ -23,7 +23,7 @@ func unixSyslog() (conn net.Conn, err error) { if err != nil { continue } else { - return conn, nil + return netConn{conn}, nil } } } -- cgit v1.2.3 From 51270fc1d14eb9c5db31a94644996bc6b4f327d4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 24 Jul 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201198 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d34cb4f2882..b9384b74576 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130723 +20130724 -- cgit v1.2.3 From 9de006784ae418e2a52c0092870d29ebb3a32daa Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 13:09:46 +0000 Subject: net/http: Don't try to trace sendfile64 on alpha. From Uros Bizjak. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201207 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/net/http/fs_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libgo/go/net/http/fs_test.go b/libgo/go/net/http/fs_test.go index 2c3737653b3..d38966764b1 100644 --- a/libgo/go/net/http/fs_test.go +++ b/libgo/go/net/http/fs_test.go @@ -696,8 +696,13 @@ func TestLinuxSendfile(t *testing.T) { } defer ln.Close() + trace := "trace=sendfile" + if runtime.GOARCH != "alpha" { + trace = trace + ",sendfile64" + } + var buf bytes.Buffer - child := exec.Command("strace", "-f", "-q", "-e", "trace=sendfile,sendfile64", os.Args[0], "-test.run=TestLinuxSendfileChild") + child := exec.Command("strace", "-f", "-q", "-e", trace, os.Args[0], "-test.run=TestLinuxSendfileChild") child.ExtraFiles = append(child.ExtraFiles, lnf) child.Env = append([]string{"GO_WANT_HELPER_PROCESS=1"}, os.Environ()...) child.Stdout = &buf -- cgit v1.2.3 From 85953be4afaa86e287756e61032557e534681254 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 13:19:00 +0000 Subject: runtime: Move new 1.1.1 functions from thread-linux.c to runtime.c. This way they are compiled on non-GNU/Linux systems. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201210 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/runtime.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ libgo/runtime/thread-linux.c | 46 ------------------------------------------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c index 138e5af67c4..1ff6d00e299 100644 --- a/libgo/runtime/runtime.c +++ b/libgo/runtime/runtime.c @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include #include #include "config.h" @@ -232,3 +233,49 @@ runtime_pprof_runtime_cyclesPerSecond(void) { return runtime_tickspersecond(); } + +// Called to initialize a new m (including the bootstrap m). +// Called on the parent thread (main thread in case of bootstrap), can allocate memory. +void +runtime_mpreinit(M *mp) +{ + mp->gsignal = runtime_malg(32*1024, &mp->gsignalstack, &mp->gsignalstacksize); // OS X wants >=8K, Linux >=2K +} + +// Called to initialize a new m (including the bootstrap m). +// Called on the new thread, can not allocate memory. +void +runtime_minit(void) +{ + M* m; + sigset_t sigs; + + // Initialize signal handling. + m = runtime_m(); + runtime_signalstack(m->gsignalstack, m->gsignalstacksize); + if (sigemptyset(&sigs) != 0) + runtime_throw("sigemptyset"); + sigprocmask(SIG_SETMASK, &sigs, nil); +} + +// Called from dropm to undo the effect of an minit. +void +runtime_unminit(void) +{ + runtime_signalstack(nil, 0); +} + + +void +runtime_signalstack(byte *p, int32 n) +{ + stack_t st; + + st.ss_sp = p; + st.ss_size = n; + st.ss_flags = 0; + if(p == nil) + st.ss_flags = SS_DISABLE; + if(sigaltstack(&st, nil) < 0) + *(int *)0xf1 = 0xf1; +} diff --git a/libgo/runtime/thread-linux.c b/libgo/runtime/thread-linux.c index 74139ea2625..13d23c47b07 100644 --- a/libgo/runtime/thread-linux.c +++ b/libgo/runtime/thread-linux.c @@ -15,7 +15,6 @@ // Futexsleep is allowed to wake up spuriously. #include -#include #include #include #include @@ -84,48 +83,3 @@ runtime_goenvs(void) { runtime_goenvs_unix(); } - -// Called to initialize a new m (including the bootstrap m). -// Called on the parent thread (main thread in case of bootstrap), can allocate memory. -void -runtime_mpreinit(M *mp) -{ - mp->gsignal = runtime_malg(32*1024, &mp->gsignalstack, &mp->gsignalstacksize); // OS X wants >=8K, Linux >=2K -} - -// Called to initialize a new m (including the bootstrap m). -// Called on the new thread, can not allocate memory. -void -runtime_minit(void) -{ - M* m; - sigset_t sigs; - - // Initialize signal handling. - m = runtime_m(); - runtime_signalstack(m->gsignalstack, m->gsignalstacksize); - if (sigemptyset(&sigs) != 0) - runtime_throw("sigemptyset"); - sigprocmask(SIG_SETMASK, &sigs, nil); -} - -// Called from dropm to undo the effect of an minit. -void -runtime_unminit(void) -{ - runtime_signalstack(nil, 0); -} - -void -runtime_signalstack(byte *p, int32 n) -{ - stack_t st; - - st.ss_sp = p; - st.ss_size = n; - st.ss_flags = 0; - if(p == nil) - st.ss_flags = SS_DISABLE; - if(sigaltstack(&st, nil) < 0) - *(int *)0xf1 = 0xf1; -} -- cgit v1.2.3 From 6d4b6078106a868e530fb7ed2d11832b548d356e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 16:53:32 +0000 Subject: net: Only use GNU/Linux unix socket abstract paths on GNU/Linux. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201218 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/syscall/socket.go | 6 +----- libgo/go/syscall/socket_bsd.go | 38 ++++++++++++++++++++----------------- libgo/go/syscall/socket_irix.go | 4 ++++ libgo/go/syscall/socket_linux.go | 9 +++++++++ libgo/go/syscall/socket_solaris.go | 39 ++++++++++++++------------------------ 5 files changed, 49 insertions(+), 47 deletions(-) diff --git a/libgo/go/syscall/socket.go b/libgo/go/syscall/socket.go index cf0c08ebbf8..cc98d6b79fd 100644 --- a/libgo/go/syscall/socket.go +++ b/libgo/go/syscall/socket.go @@ -92,11 +92,7 @@ func (sa *SockaddrUnix) sockaddr() (*RawSockaddrAny, Socklen_t, error) { if n > 0 { sl += Socklen_t(n) + 1 } - if sa.raw.Path[0] == '@' { - sa.raw.Path[0] = 0 - // Don't count trailing NUL for abstract address. - sl-- - } + sl = sa.raw.adjustAbstract(sl) // length is family (uint16), name, NUL. return (*RawSockaddrAny)(unsafe.Pointer(&sa.raw)), sl, nil diff --git a/libgo/go/syscall/socket_bsd.go b/libgo/go/syscall/socket_bsd.go index be559915951..72d7180b6ed 100644 --- a/libgo/go/syscall/socket_bsd.go +++ b/libgo/go/syscall/socket_bsd.go @@ -11,11 +11,11 @@ const SizeofSockaddrInet6 = 28 const SizeofSockaddrUnix = 110 type RawSockaddrInet4 struct { - Len uint8; - Family uint8; - Port uint16; - Addr [4]byte /* in_addr */; - Zero [8]uint8; + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 } func (sa *RawSockaddrInet4) setLen() Socklen_t { @@ -24,12 +24,12 @@ func (sa *RawSockaddrInet4) setLen() Socklen_t { } type RawSockaddrInet6 struct { - Len uint8; - Family uint8; - Port uint16; - Flowinfo uint32; - Addr [16]byte /* in6_addr */; - Scope_id uint32; + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 } func (sa *RawSockaddrInet6) setLen() Socklen_t { @@ -38,9 +38,9 @@ func (sa *RawSockaddrInet6) setLen() Socklen_t { } type RawSockaddrUnix struct { - Len uint8; - Family uint8; - Path [108]int8; + Len uint8 + Family uint8 + Path [108]int8 } func (sa *RawSockaddrUnix) setLen(n int) { @@ -62,10 +62,14 @@ func (sa *RawSockaddrUnix) getLen() (int, error) { return n, nil } +func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t { + return sl +} + type RawSockaddr struct { - Len uint8; - Family uint8; - Data [14]int8; + Len uint8 + Family uint8 + Data [14]int8 } // BindToDevice binds the socket associated with fd to device. diff --git a/libgo/go/syscall/socket_irix.go b/libgo/go/syscall/socket_irix.go index 289769b6d3f..bcd1781d570 100644 --- a/libgo/go/syscall/socket_irix.go +++ b/libgo/go/syscall/socket_irix.go @@ -64,6 +64,10 @@ func (sa *RawSockaddrUnix) getLen() (int, error) { return n, nil } +func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t { + return sl +} + type RawSockaddr struct { Family uint16 Data [14]int8 diff --git a/libgo/go/syscall/socket_linux.go b/libgo/go/syscall/socket_linux.go index 49a1625d08d..8546abc3e06 100644 --- a/libgo/go/syscall/socket_linux.go +++ b/libgo/go/syscall/socket_linux.go @@ -110,6 +110,15 @@ func (sa *RawSockaddrUnix) getLen() (int, error) { return n, nil } +func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t { + if sa.Path[0] == '@' { + sa.Path[0] = 0 + // Don't count trailing NUL for abstract address. + sl-- + } + return sl +} + type RawSockaddrLinklayer struct { Family uint16 Protocol uint16 diff --git a/libgo/go/syscall/socket_solaris.go b/libgo/go/syscall/socket_solaris.go index 0a03465a338..39588892f2b 100644 --- a/libgo/go/syscall/socket_solaris.go +++ b/libgo/go/syscall/socket_solaris.go @@ -12,9 +12,9 @@ const SizeofSockaddrUnix = 110 type RawSockaddrInet4 struct { Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 } func (sa *RawSockaddrInet4) setLen() Socklen_t { @@ -22,12 +22,12 @@ func (sa *RawSockaddrInet4) setLen() Socklen_t { } type RawSockaddrInet6 struct { - Family uint16 - Port uint16 + Family uint16 + Port uint16 Flowinfo uint32 - Addr [16]byte /* in6_addr */ + Addr [16]byte /* in6_addr */ Scope_id uint32 - Src_id uint32 + Src_id uint32 } func (sa *RawSockaddrInet6) setLen() Socklen_t { @@ -36,38 +36,27 @@ func (sa *RawSockaddrInet6) setLen() Socklen_t { type RawSockaddrUnix struct { Family uint16 - Path [108]int8 + Path [108]int8 } func (sa *RawSockaddrUnix) setLen(int) { } func (sa *RawSockaddrUnix) getLen() (int, error) { - if sa.Path[0] == 0 { - // "Abstract" Unix domain socket. - // Rewrite leading NUL as @ for textual display. - // (This is the standard convention.) - // Not friendly to overwrite in place, - // but the callers below don't care. - sa.Path[0] = '@' - } - - // Assume path ends at NUL. - // This is not technically the GNU/Linux semantics for - // abstract Unix domain sockets--they are supposed - // to be uninterpreted fixed-size binary blobs--but - // everyone uses this convention. n := 0 - for n < len(sa.Path) - 3 && sa.Path[n] != 0 { + for n < len(sa.Path) && sa.Path[n] != 0 { n++ } - return n, nil } +func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t { + return sl +} + type RawSockaddr struct { Family uint16 - Data [14]int8 + Data [14]int8 } // BindToDevice binds the socket associated with fd to device. -- cgit v1.2.3 From be3e96d5213d6b73378f112f4a48b9aa2a913293 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 17:37:19 +0000 Subject: runtime: Check _end rather than end to find end of program. This fixes a problem on Solaris, where end is not defined in the main program but comes from some shared library. This only matters for 32-bit targets. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201221 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/malloc.goc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc index dfab683950a..4b93e970769 100644 --- a/libgo/runtime/malloc.goc +++ b/libgo/runtime/malloc.goc @@ -319,7 +319,7 @@ runtime_mallocinit(void) { byte *p; uintptr arena_size, bitmap_size; - extern byte end[]; + extern byte _end[]; byte *want; uintptr limit; @@ -408,7 +408,7 @@ runtime_mallocinit(void) // So adjust it upward a little bit ourselves: 1/4 MB to get // away from the running binary image and then round up // to a MB boundary. - want = (byte*)(((uintptr)end + (1<<18) + (1<<20) - 1)&~((1<<20)-1)); + want = (byte*)(((uintptr)_end + (1<<18) + (1<<20) - 1)&~((1<<20)-1)); if(0xffffffff - (uintptr)want <= bitmap_size + arena_size) want = 0; p = runtime_SysReserve(want, bitmap_size + arena_size); -- cgit v1.2.3 From 32186b08cbcd706254d5abaac544ce697a85097e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 18:26:58 +0000 Subject: * go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a fields, recreate those fields with the first one with a non-zero size. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 6 ++++++ gcc/go/go-gcc.cc | 49 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index d478c3ed9b4..094116d1b22 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2013-07-24 Ian Lance Taylor + + * go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a + fields, recreate those fields with the first one with a non-zero + size. + 2013-06-18 Ian Lance Taylor * go-gcc.cc (Gcc_backend::immutable_struct): Add is_hidden diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index bd2d0dd0829..27c756e5496 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1242,20 +1242,41 @@ Gcc_backend::non_zero_size_type(tree type) switch (TREE_CODE(type)) { case RECORD_TYPE: - { - if (go_non_zero_struct == NULL_TREE) - { - type = make_node(RECORD_TYPE); - tree field = build_decl(UNKNOWN_LOCATION, FIELD_DECL, - get_identifier("dummy"), - boolean_type_node); - DECL_CONTEXT(field) = type; - TYPE_FIELDS(type) = field; - layout_type(type); - go_non_zero_struct = type; - } - return go_non_zero_struct; - } + if (TYPE_FIELDS(type) != NULL_TREE) + { + tree ns = make_node(RECORD_TYPE); + tree field_trees = NULL_TREE; + tree *pp = &field_trees; + for (tree field = TYPE_FIELDS(type); + field != NULL_TREE; + field = DECL_CHAIN(field)) + { + tree ft = TREE_TYPE(field); + if (field == TYPE_FIELDS(type)) + ft = non_zero_size_type(ft); + tree f = build_decl(DECL_SOURCE_LOCATION(field), FIELD_DECL, + DECL_NAME(field), ft); + DECL_CONTEXT(f) = ns; + *pp = f; + pp = &DECL_CHAIN(f); + } + TYPE_FIELDS(ns) = field_trees; + layout_type(ns); + return ns; + } + + if (go_non_zero_struct == NULL_TREE) + { + type = make_node(RECORD_TYPE); + tree field = build_decl(UNKNOWN_LOCATION, FIELD_DECL, + get_identifier("dummy"), + boolean_type_node); + DECL_CONTEXT(field) = type; + TYPE_FIELDS(type) = field; + layout_type(type); + go_non_zero_struct = type; + } + return go_non_zero_struct; case ARRAY_TYPE: { -- cgit v1.2.3 From 2b2fc82bded96ab22a90fa201ec741dd62b04122 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 24 Jul 2013 22:30:39 +0000 Subject: runtime: Handle allocating memory in cgo/SWIG function. A function that returns an interface type and returns a value that requires memory allocation will try to allocate while appearing to be in a syscall. This patch lets that work. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201227 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/malloc.goc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libgo/runtime/malloc.goc b/libgo/runtime/malloc.goc index 4b93e970769..8ccaa6b888c 100644 --- a/libgo/runtime/malloc.goc +++ b/libgo/runtime/malloc.goc @@ -41,11 +41,24 @@ runtime_mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed) uintptr npages; MSpan *s; void *v; + bool incallback; m = runtime_m(); g = runtime_g(); - if(g->status == Gsyscall) - dogc = 0; + + incallback = false; + if(m->mcache == nil && g->ncgo > 0) { + // For gccgo this case can occur when a cgo or SWIG function + // has an interface return type and the function + // returns a non-pointer, so memory allocation occurs + // after syscall.Cgocall but before syscall.CgocallDone. + // We treat it as a callback. + runtime_exitsyscall(); + m = runtime_m(); + incallback = true; + dogc = false; + } + if(runtime_gcwaiting && g != m->g0 && m->locks == 0 && dogc) { runtime_gosched(); m = runtime_m(); @@ -129,6 +142,10 @@ runtime_mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed) runtime_racemalloc(v, size, m->racepc); m->racepc = nil; } + + if(incallback) + runtime_entersyscall(); + return v; } -- cgit v1.2.3 From 8fac1297fa69cadc99a4530023e06d3a7f91795a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 25 Jul 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201232 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b9384b74576..49ded2bcfd0 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130724 +20130725 -- cgit v1.2.3 From 337694b57b1f4a719eb887ae4748ae0931bf4b10 Mon Sep 17 00:00:00 2001 From: Terry Guo Date: Thu, 25 Jul 2013 05:27:55 +0000 Subject: gcc/ChangeLog: Backport from mainline: 2013-07-25 Terry Guo * config/arm/arm.c (thumb1_size_rtx_costs): Assign proper cost for shift_add/shift_sub0/shift_sub1 RTXs. gcc/testsuite/ChangeLog: Backport from mainline: 2013-07-25 Terry Guo * gcc.target/arm/thumb1-Os-mult.c: New test case. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201238 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/arm/arm.c | 9 +++++++++ gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/arm/thumb1-Os-mult.c | 12 ++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arm/thumb1-Os-mult.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ede48774278..03d681a02c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-07-25 Terry Guo + + Backport from mainline: + 2013-07-25 Terry Guo + + * config/arm/arm.c (thumb1_size_rtx_costs): Assign proper cost for + shift_add/shift_sub0/shift_sub1 RTXs. + 2013-07-22 Iain Sandoe Backport from mainline: diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index edf850d9bff..d76278bb531 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -7839,6 +7839,15 @@ thumb1_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer) case PLUS: case MINUS: + /* Thumb-1 needs two instructions to fulfill shiftadd/shiftsub0/shiftsub1 + defined by RTL expansion, especially for the expansion of + multiplication. */ + if ((GET_CODE (XEXP (x, 0)) == MULT + && power_of_two_operand (XEXP (XEXP (x,0),1), SImode)) + || (GET_CODE (XEXP (x, 1)) == MULT + && power_of_two_operand (XEXP (XEXP (x, 1), 1), SImode))) + return COSTS_N_INSNS (2); + /* On purpose fall through for normal RTX. */ case COMPARE: case NEG: case NOT: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 183bdaef6ba..477c5163875 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-07-25 Terry Guo + + Backport from mainline: + 2013-07-25 Terry Guo + + * gcc.target/arm/thumb1-Os-mult.c: New test case. + 2013-07-19 Wei Mi Backport from mainline: diff --git a/gcc/testsuite/gcc.target/arm/thumb1-Os-mult.c b/gcc/testsuite/gcc.target/arm/thumb1-Os-mult.c new file mode 100644 index 00000000000..31b8bd69227 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-Os-mult.c @@ -0,0 +1,12 @@ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-skip-if "" { ! { arm_thumb1 } } } */ + +int +mymul3 (int x) +{ + return x * 0x555; +} + +/* { dg-final { scan-assembler "mul\[\\t \]*r.,\[\\t \]*r." } } */ -- cgit v1.2.3 From abee2ea043c5ff72f74c20786a85df647a0370c6 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 25 Jul 2013 15:07:27 +0000 Subject: /cp 2013-07-25 Paolo Carlini PR c++/57981 * decl.c (check_default_argument): Take a tsubst_flags_t parameter. (grokparms): Adjust. * parser.c (cp_parser_late_parse_one_default_arg): Likewise. * pt.c (tsubst_default_argument, tsubst_default_arguments): Take a tsubst_flags_t parameter. (tsubst_decl): Adjust. * call.c (convert_default_arg): Likewise. * cp-tree.h (check_default_argument, tsubst_default_argument): Update declarations. /testsuite 2013-07-25 Paolo Carlini PR c++/57981 * g++.dg/cpp0x/pr57981.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201246 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/call.c | 2 +- gcc/cp/cp-tree.h | 5 +++-- gcc/cp/decl.c | 19 ++++++++++++------- gcc/cp/parser.c | 3 ++- gcc/cp/pt.c | 18 ++++++++++-------- gcc/testsuite/ChangeLog | 5 +++++ 7 files changed, 46 insertions(+), 19 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fd4ceeb2cff..77cc324f91b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2013-07-25 Paolo Carlini + + PR c++/57981 + * decl.c (check_default_argument): Take a tsubst_flags_t parameter. + (grokparms): Adjust. + * parser.c (cp_parser_late_parse_one_default_arg): Likewise. + * pt.c (tsubst_default_argument, tsubst_default_arguments): Take + a tsubst_flags_t parameter. + (tsubst_decl): Adjust. + * call.c (convert_default_arg): Likewise. + * cp-tree.h (check_default_argument, tsubst_default_argument): + Update declarations. + 2013-07-12 Jason Merrill * init.c (build_vec_init): Value-initialize the rest of the array. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9275133d636..a5be421fec7 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -6390,7 +6390,7 @@ convert_default_arg (tree type, tree arg, tree fn, int parmnum, push_defarg_context (fn); if (fn && DECL_TEMPLATE_INFO (fn)) - arg = tsubst_default_argument (fn, type, arg); + arg = tsubst_default_argument (fn, type, arg, complain); /* Due to: diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 86a2807308e..b10c53bc499 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5178,7 +5178,7 @@ extern tree static_fn_type (tree); extern void revert_static_member_fn (tree); extern void fixup_anonymous_aggr (tree); extern tree compute_array_index_type (tree, tree, tsubst_flags_t); -extern tree check_default_argument (tree, tree); +extern tree check_default_argument (tree, tree, tsubst_flags_t); typedef int (*walk_namespaces_fn) (tree, void *); extern int walk_namespaces (walk_namespaces_fn, void *); @@ -5453,7 +5453,8 @@ extern tree maybe_process_partial_specialization (tree); extern tree most_specialized_instantiation (tree); extern void print_candidates (tree); extern void instantiate_pending_templates (int); -extern tree tsubst_default_argument (tree, tree, tree); +extern tree tsubst_default_argument (tree, tree, tree, + tsubst_flags_t); extern tree tsubst (tree, tree, tsubst_flags_t, tree); extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, tree, bool, bool); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 09296debeae..df979c2924b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10878,7 +10878,7 @@ local_variable_p_walkfn (tree *tp, int *walk_subtrees, DECL, if there is no DECL available. */ tree -check_default_argument (tree decl, tree arg) +check_default_argument (tree decl, tree arg, tsubst_flags_t complain) { tree var; tree decl_type; @@ -10910,13 +10910,14 @@ check_default_argument (tree decl, tree arg) A default argument expression is implicitly converted to the parameter type. */ ++cp_unevaluated_operand; - perform_implicit_conversion_flags (decl_type, arg, tf_warning_or_error, + perform_implicit_conversion_flags (decl_type, arg, complain, LOOKUP_IMPLICIT); --cp_unevaluated_operand; if (warn_zero_as_null_pointer_constant && TYPE_PTR_OR_PTRMEM_P (decl_type) && null_ptr_cst_p (arg) + && (complain & tf_warning) && maybe_warn_zero_as_null_pointer_constant (arg, input_location)) return nullptr_node; @@ -10930,10 +10931,14 @@ check_default_argument (tree decl, tree arg) var = cp_walk_tree_without_duplicates (&arg, local_variable_p_walkfn, NULL); if (var) { - if (DECL_NAME (var) == this_identifier) - permerror (input_location, "default argument %qE uses %qD", arg, var); - else - error ("default argument %qE uses local variable %qD", arg, var); + if (complain & tf_warning_or_error) + { + if (DECL_NAME (var) == this_identifier) + permerror (input_location, "default argument %qE uses %qD", + arg, var); + else + error ("default argument %qE uses local variable %qD", arg, var); + } return error_mark_node; } @@ -11084,7 +11089,7 @@ grokparms (tree parmlist, tree *parms) if (any_error) init = NULL_TREE; else if (init && !processing_template_decl) - init = check_default_argument (decl, init); + init = check_default_argument (decl, init, tf_warning_or_error); } DECL_CHAIN (decl) = decls; diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 15918a9ae08..8798fb3ea9a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -22566,7 +22566,8 @@ cp_parser_late_parse_one_default_arg (cp_parser *parser, tree decl, /* In a non-template class, check conversions now. In a template, we'll wait and instantiate these as needed. */ if (TREE_CODE (decl) == PARM_DECL) - parsed_arg = check_default_argument (parmtype, parsed_arg); + parsed_arg = check_default_argument (parmtype, parsed_arg, + tf_warning_or_error); else { int flags = LOOKUP_IMPLICIT; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 043a8f80819..ed4a689b035 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -184,7 +184,7 @@ static int coerce_template_template_parms (tree, tree, tsubst_flags_t, tree, tree); static bool template_template_parm_bindings_ok_p (tree, tree); static int template_args_equal (tree, tree); -static void tsubst_default_arguments (tree); +static void tsubst_default_arguments (tree, tsubst_flags_t); static tree for_each_template_parm_r (tree *, int *, void *); static tree copy_default_args_to_explicit_spec_1 (tree, tree); static void copy_default_args_to_explicit_spec (tree); @@ -9864,7 +9864,7 @@ tsubst_aggr_type (tree t, FN), which has the indicated TYPE. */ tree -tsubst_default_argument (tree fn, tree type, tree arg) +tsubst_default_argument (tree fn, tree type, tree arg, tsubst_flags_t complain) { tree saved_class_ptr = NULL_TREE; tree saved_class_ref = NULL_TREE; @@ -9904,7 +9904,7 @@ tsubst_default_argument (tree fn, tree type, tree arg) stack. */ ++function_depth; arg = tsubst_expr (arg, DECL_TI_ARGS (fn), - tf_warning_or_error, NULL_TREE, + complain, NULL_TREE, /*integral_constant_expression_p=*/false); --function_depth; pop_deferring_access_checks(); @@ -9916,12 +9916,13 @@ tsubst_default_argument (tree fn, tree type, tree arg) cp_function_chain->x_current_class_ref = saved_class_ref; } - if (errorcount+sorrycount > errs) + if (errorcount+sorrycount > errs + && (complain & tf_warning_or_error)) inform (input_location, " when instantiating default argument for call to %D", fn); /* Make sure the default argument is reasonable. */ - arg = check_default_argument (type, arg); + arg = check_default_argument (type, arg, complain); pop_access_scope (fn); @@ -9931,7 +9932,7 @@ tsubst_default_argument (tree fn, tree type, tree arg) /* Substitute into all the default arguments for FN. */ static void -tsubst_default_arguments (tree fn) +tsubst_default_arguments (tree fn, tsubst_flags_t complain) { tree arg; tree tmpl_args; @@ -9952,7 +9953,8 @@ tsubst_default_arguments (tree fn) if (TREE_PURPOSE (arg)) TREE_PURPOSE (arg) = tsubst_default_argument (fn, TREE_VALUE (arg), - TREE_PURPOSE (arg)); + TREE_PURPOSE (arg), + complain); } /* Substitute the ARGS into the T, which is a _DECL. Return the @@ -10303,7 +10305,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) if (!member && !PRIMARY_TEMPLATE_P (gen_tmpl) && !uses_template_parms (argvec)) - tsubst_default_arguments (r); + tsubst_default_arguments (r, complain); } else DECL_TEMPLATE_INFO (r) = NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 477c5163875..6b0dfd4bad9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-25 Paolo Carlini + + PR c++/57981 + * g++.dg/cpp0x/pr57981.C: New. + 2013-07-25 Terry Guo Backport from mainline: -- cgit v1.2.3 From f2e0b248526bb7f0bb0691bea0e7d61661bd3042 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 26 Jul 2013 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201258 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 49ded2bcfd0..cb22c92287c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130725 +20130726 -- cgit v1.2.3 From 0a1319118d2ea2c54fb3c8d613b9b5ece4ef695f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 27 Jul 2013 00:16:36 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201278 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cb22c92287c..b4ce1868021 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130726 +20130727 -- cgit v1.2.3 From 5760c44959f29d34627ed605e95065bf60ae1cd1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 28 Jul 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201289 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b4ce1868021..66db563c880 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130727 +20130728 -- cgit v1.2.3 From a5c06317562842504de8614590573f19872d7d39 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 28 Jul 2013 02:33:01 +0000 Subject: PR libstdc++/57914 * libsupc++/atexit_thread.cc (run): Delete cleanup elts. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201291 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/libsupc++/atexit_thread.cc | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d9ce94b6520..71a76dec7cf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2013-07-22 Jason Merrill + + PR libstdc++/57914 + * libsupc++/atexit_thread.cc (run): Delete cleanup elts. + 2013-06-27 Paolo Carlini * include/profile/vector (emplace(iterator, _Args&&...)): Define. diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc index 3b33df233e8..11f1dbdeac4 100644 --- a/libstdc++-v3/libsupc++/atexit_thread.cc +++ b/libstdc++-v3/libsupc++/atexit_thread.cc @@ -58,8 +58,13 @@ namespace { void run (void *p) { elt *e = static_cast(p); - for (; e; e = e->next) - e->destructor (e->object); + while (e) + { + elt *old_e = e; + e->destructor (e->object); + e = e->next; + delete (old_e); + } } // Run the stack of cleanups for the current thread. @@ -67,9 +72,15 @@ namespace { { void *e; if (__gthread_active_p ()) - e = __gthread_getspecific (key); + { + e = __gthread_getspecific (key); + __gthread_setspecific (key, NULL); + } else - e = single_thread; + { + e = single_thread; + single_thread = NULL; + } run (e); } -- cgit v1.2.3 From e5a97ccf48d1cec6ecde295a09a4f87f9ac22096 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Sun, 28 Jul 2013 14:13:17 +0000 Subject: 2013-07-28 Tobias Burnus Backport from mainline 2013-05-28 Dominique d'Humieres PR fortran/57435 * module.c (check_for_ambiguous): Avoid null pointer deref. 2013-07-28 Tobias Burnus Backport from mainline 2013-05-28 Tobias Burnus PR fortran/57435 * gfortran.dg/use_29.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201293 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/module.c | 2 +- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/use_29.f90 | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/use_29.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 77abdc0ec66..9a8b794bc57 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2013-07-28 Tobias Burnus + + Backport from mainline + 2013-05-28 Dominique d'Humieres + + PR fortran/57435 + * module.c (check_for_ambiguous): Avoid null pointer deref. + 2013-07-08 Tobias Burnus PR fortran/57785 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 1b385558424..f0f8f971ed8 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4465,7 +4465,7 @@ check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info) module_locus locus; symbol_attribute attr; - if (st_sym->name == gfc_current_ns->proc_name->name) + if (gfc_current_ns->proc_name && st_sym->name == gfc_current_ns->proc_name->name) { gfc_error ("'%s' of module '%s', imported at %C, is also the name of the " "current program unit", st_sym->name, module_name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6b0dfd4bad9..6f81dc010e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-07-28 Tobias Burnus + + Backport from mainline + 2013-05-28 Tobias Burnus + + PR fortran/57435 + * gfortran.dg/use_29.f90: New. + 2013-07-25 Paolo Carlini PR c++/57981 diff --git a/gcc/testsuite/gfortran.dg/use_29.f90 b/gcc/testsuite/gfortran.dg/use_29.f90 new file mode 100644 index 00000000000..89dfe509314 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/use_29.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! +! PR fortran/57435 +! +! Contributed by Lorenz Hüdepohl +! +module precision +end module precision + contains + use precision ! { dg-error "Unexpected USE statement in CONTAINS section" } +module stressten_rt ! { dg-error "Unexpected MODULE statement in CONTAINS section" } + use precision ! { dg-error "Unexpected USE statement in CONTAINS section" } + implicit none ! { dg-error "Unexpected IMPLICIT NONE statement in CONTAINS section" } + +! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 } -- cgit v1.2.3 From d3cf069aa1a60dddc518aa68a0e32639ec7e0c02 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 29 Jul 2013 00:16:33 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201296 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 66db563c880..a7af27726c6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130728 +20130729 -- cgit v1.2.3 From 89972e1343a11f82c5c237e7e69df3a6939c1a96 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 29 Jul 2013 09:02:24 +0000 Subject: 2013-07-29 Paolo Carlini * include/profile/unordered_map (unordered_map<>, unordered_multimap<>): Clean-up constructors and assignment operators to match debug-mode. * include/profile/unordered_set (unordered_set<>, unordered_multiset<>): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201302 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 +++ libstdc++-v3/include/profile/unordered_map | 98 +++++------------------------- libstdc++-v3/include/profile/unordered_set | 97 +++++------------------------ 3 files changed, 37 insertions(+), 166 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 71a76dec7cf..7805a60c112 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-07-29 Paolo Carlini + + * include/profile/unordered_map (unordered_map<>, + unordered_multimap<>): Clean-up constructors and assignment + operators to match debug-mode. + * include/profile/unordered_set (unordered_set<>, + unordered_multiset<>): Likewise. + 2013-07-22 Jason Merrill PR libstdc++/57914 diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 0fee176e14a..0f7db379e85 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -73,10 +73,7 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } template unordered_map(_InputIterator __f, _InputIterator __l, @@ -85,31 +82,15 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } - unordered_map(const unordered_map& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_map(const unordered_map&) = default; unordered_map(const _Base& __x) : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } - unordered_map(unordered_map&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_map(unordered_map&&) = default; unordered_map(initializer_list __l, size_type __n = 0, @@ -119,21 +100,10 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_map& - operator=(const unordered_map& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_map&) = default; unordered_map& - operator=(unordered_map&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_map&&) = default; unordered_map& operator=(initializer_list __l) @@ -143,13 +113,6 @@ namespace __profile return *this; } - ~unordered_map() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - _Base& _M_base() noexcept { return *this; } @@ -374,9 +337,8 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } + template unordered_multimap(_InputIterator __f, _InputIterator __l, size_type __n = 0, @@ -384,27 +346,15 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } - unordered_multimap(const unordered_multimap& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multimap(const unordered_multimap&) = default; unordered_multimap(const _Base& __x) : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } - unordered_multimap(unordered_multimap&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multimap(unordered_multimap&&) = default; unordered_multimap(initializer_list __l, size_type __n = 0, @@ -414,21 +364,10 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_multimap& - operator=(const unordered_multimap& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_multimap&) = default; unordered_multimap& - operator=(unordered_multimap&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_multimap&&) = default; unordered_multimap& operator=(initializer_list __l) @@ -438,13 +377,6 @@ namespace __profile return *this; } - ~unordered_multimap() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void clear() noexcept { diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set index 737b6ec6b96..9fa538a5af2 100644 --- a/libstdc++-v3/include/profile/unordered_set +++ b/libstdc++-v3/include/profile/unordered_set @@ -72,10 +72,7 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } template unordered_set(_InputIterator __f, _InputIterator __l, @@ -84,31 +81,15 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } - unordered_set(const unordered_set& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_set(const unordered_set&) = default; unordered_set(const _Base& __x) : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + { } - unordered_set(unordered_set&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_set(unordered_set&&) = default; unordered_set(initializer_list __l, size_type __n = 0, @@ -118,21 +99,10 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_set& - operator=(const unordered_set& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_set&) = default; unordered_set& - operator=(unordered_set&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_set&&) = default; unordered_set& operator=(initializer_list __l) @@ -142,13 +112,6 @@ namespace __profile return *this; } - ~unordered_set() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void swap(unordered_set& __x) { @@ -340,9 +303,7 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } template unordered_multiset(_InputIterator __f, _InputIterator __l, @@ -351,27 +312,15 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } - unordered_multiset(const unordered_multiset& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multiset(const unordered_multiset&) = default; unordered_multiset(const _Base& __x) : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + { } - unordered_multiset(unordered_multiset&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multiset(unordered_multiset&&) = default; unordered_multiset(initializer_list __l, size_type __n = 0, @@ -381,21 +330,10 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_multiset& - operator=(const unordered_multiset& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_multiset&) = default; unordered_multiset& - operator=(unordered_multiset&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_multiset&&) = default; unordered_multiset& operator=(initializer_list __l) @@ -405,13 +343,6 @@ namespace __profile return *this; } - ~unordered_multiset() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void swap(unordered_multiset& __x) { -- cgit v1.2.3 From bbf03f51d7c72b028e2cb5c5af17edc8f283e7e5 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 29 Jul 2013 09:10:52 +0000 Subject: 2013-07-29 Paolo Carlini Revert last commit. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201303 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 4 ++ libstdc++-v3/include/profile/unordered_map | 98 +++++++++++++++++++++++++----- libstdc++-v3/include/profile/unordered_set | 97 ++++++++++++++++++++++++----- 3 files changed, 170 insertions(+), 29 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7805a60c112..e503687e073 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2013-07-29 Paolo Carlini + + Revert last commit. + 2013-07-29 Paolo Carlini * include/profile/unordered_map (unordered_map<>, diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 0f7db379e85..0fee176e14a 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -73,7 +73,10 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } template unordered_map(_InputIterator __f, _InputIterator __l, @@ -82,15 +85,31 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } - unordered_map(const unordered_map&) = default; + unordered_map(const unordered_map& __x) + : _Base(__x) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } unordered_map(const _Base& __x) : _Base(__x) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } - unordered_map(unordered_map&&) = default; + unordered_map(unordered_map&& __x) + : _Base(std::move(__x)) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } unordered_map(initializer_list __l, size_type __n = 0, @@ -100,10 +119,21 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_map& - operator=(const unordered_map&) = default; + operator=(const unordered_map& __x) + { + *static_cast<_Base*>(this) = __x; + return *this; + } unordered_map& - operator=(unordered_map&&) = default; + operator=(unordered_map&& __x) + { + // NB: DR 1204. + // NB: DR 675. + this->clear(); + this->swap(__x); + return *this; + } unordered_map& operator=(initializer_list __l) @@ -113,6 +143,13 @@ namespace __profile return *this; } + ~unordered_map() noexcept + { + __profcxx_hashtable_destruct(this, _Base::bucket_count(), + _Base::size()); + _M_profile_destruct(); + } + _Base& _M_base() noexcept { return *this; } @@ -337,8 +374,9 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { } - + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } template unordered_multimap(_InputIterator __f, _InputIterator __l, size_type __n = 0, @@ -346,15 +384,27 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } - unordered_multimap(const unordered_multimap&) = default; + unordered_multimap(const unordered_multimap& __x) + : _Base(__x) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } unordered_multimap(const _Base& __x) : _Base(__x) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } - unordered_multimap(unordered_multimap&&) = default; + unordered_multimap(unordered_multimap&& __x) + : _Base(std::move(__x)) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } unordered_multimap(initializer_list __l, size_type __n = 0, @@ -364,10 +414,21 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_multimap& - operator=(const unordered_multimap&) = default; + operator=(const unordered_multimap& __x) + { + *static_cast<_Base*>(this) = __x; + return *this; + } unordered_multimap& - operator=(unordered_multimap&&) = default; + operator=(unordered_multimap&& __x) + { + // NB: DR 1204. + // NB: DR 675. + this->clear(); + this->swap(__x); + return *this; + } unordered_multimap& operator=(initializer_list __l) @@ -377,6 +438,13 @@ namespace __profile return *this; } + ~unordered_multimap() noexcept + { + __profcxx_hashtable_destruct(this, _Base::bucket_count(), + _Base::size()); + _M_profile_destruct(); + } + void clear() noexcept { diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set index 9fa538a5af2..737b6ec6b96 100644 --- a/libstdc++-v3/include/profile/unordered_set +++ b/libstdc++-v3/include/profile/unordered_set @@ -72,7 +72,10 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } template unordered_set(_InputIterator __f, _InputIterator __l, @@ -81,15 +84,31 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } - unordered_set(const unordered_set&) = default; + unordered_set(const unordered_set& __x) + : _Base(__x) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } unordered_set(const _Base& __x) : _Base(__x) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } - unordered_set(unordered_set&&) = default; + unordered_set(unordered_set&& __x) + : _Base(std::move(__x)) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + __profcxx_hashtable_construct2(this); + } unordered_set(initializer_list __l, size_type __n = 0, @@ -99,10 +118,21 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_set& - operator=(const unordered_set&) = default; + operator=(const unordered_set& __x) + { + *static_cast<_Base*>(this) = __x; + return *this; + } unordered_set& - operator=(unordered_set&&) = default; + operator=(unordered_set&& __x) + { + // NB: DR 1204. + // NB: DR 675. + this->clear(); + this->swap(__x); + return *this; + } unordered_set& operator=(initializer_list __l) @@ -112,6 +142,13 @@ namespace __profile return *this; } + ~unordered_set() noexcept + { + __profcxx_hashtable_destruct(this, _Base::bucket_count(), + _Base::size()); + _M_profile_destruct(); + } + void swap(unordered_set& __x) { @@ -303,7 +340,9 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } template unordered_multiset(_InputIterator __f, _InputIterator __l, @@ -312,15 +351,27 @@ namespace __profile const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) : _Base(__f, __l, __n, __hf, __eql, __a) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } - unordered_multiset(const unordered_multiset&) = default; + unordered_multiset(const unordered_multiset& __x) + : _Base(__x) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } unordered_multiset(const _Base& __x) : _Base(__x) - { } + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } - unordered_multiset(unordered_multiset&&) = default; + unordered_multiset(unordered_multiset&& __x) + : _Base(std::move(__x)) + { + __profcxx_hashtable_construct(this, _Base::bucket_count()); + } unordered_multiset(initializer_list __l, size_type __n = 0, @@ -330,10 +381,21 @@ namespace __profile : _Base(__l, __n, __hf, __eql, __a) { } unordered_multiset& - operator=(const unordered_multiset&) = default; + operator=(const unordered_multiset& __x) + { + *static_cast<_Base*>(this) = __x; + return *this; + } unordered_multiset& - operator=(unordered_multiset&&) = default; + operator=(unordered_multiset&& __x) + { + // NB: DR 1204. + // NB: DR 675. + this->clear(); + this->swap(__x); + return *this; + } unordered_multiset& operator=(initializer_list __l) @@ -343,6 +405,13 @@ namespace __profile return *this; } + ~unordered_multiset() noexcept + { + __profcxx_hashtable_destruct(this, _Base::bucket_count(), + _Base::size()); + _M_profile_destruct(); + } + void swap(unordered_multiset& __x) { -- cgit v1.2.3 From af961ade6c842fc0c7447bee1d4bea68572c9160 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 30 Jul 2013 00:16:21 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201323 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a7af27726c6..0989d23cbee 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130729 +20130730 -- cgit v1.2.3 From 72c44bb2595db1c92e66b1eade23abd70406a275 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 30 Jul 2013 13:30:12 +0000 Subject: PR c++/58022 * typeck2.c (abstract_virtuals_error_sfinae): Don't remember lookup in SFINAE context. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201339 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck2.c | 2 +- gcc/testsuite/g++.dg/template/abstract1.C | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/abstract1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 77cc324f91b..7dad643b9ca 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-07-29 Jason Merrill + + PR c++/58022 + * typeck2.c (abstract_virtuals_error_sfinae): Don't remember + lookup in SFINAE context. + 2013-07-25 Paolo Carlini PR c++/57981 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 9b7db62183d..9c9f0751f33 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -262,7 +262,7 @@ abstract_virtuals_error_sfinae (tree decl, tree type, tsubst_flags_t complain) so that we can check again once it is completed. This makes sense only for objects for which we have a declaration or at least a name. */ - if (!COMPLETE_TYPE_P (type)) + if (!COMPLETE_TYPE_P (type) && (complain & tf_error)) { void **slot; struct pending_abstract_type *pat; diff --git a/gcc/testsuite/g++.dg/template/abstract1.C b/gcc/testsuite/g++.dg/template/abstract1.C new file mode 100644 index 00000000000..20bbf5a911f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/abstract1.C @@ -0,0 +1,12 @@ +// PR c++/58022 + +template struct A { }; +template A & operator<< (A&, T); +template class foo; +template A & operator<<(A& o, const foo& l); +template class foo { + friend A& operator<< (A& o, const foo& l); +}; +class bar; +foo fb; +class bar { virtual void baz()=0; }; -- cgit v1.2.3 From 38555d29075df4275135d713f11eb1fa26359e99 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 30 Jul 2013 16:58:28 +0000 Subject: PR c++/57901 * semantics.c (build_data_member_initialization, constexpr_fn_retval): Use break_out_target_exprs instead of unshare_expr. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201346 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/semantics.c | 6 +++--- gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7dad643b9ca..20e9ebaa646 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2013-07-29 Jason Merrill + PR c++/57901 + * semantics.c (build_data_member_initialization, constexpr_fn_retval): + Use break_out_target_exprs instead of unshare_expr. + PR c++/58022 * typeck2.c (abstract_virtuals_error_sfinae): Don't remember lookup in SFINAE context. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3699ea5e9a2..5b8197e3dcb 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5956,7 +5956,7 @@ build_data_member_initialization (tree t, vec **vec) || TREE_CODE (t) == MODIFY_EXPR) { member = TREE_OPERAND (t, 0); - init = unshare_expr (TREE_OPERAND (t, 1)); + init = break_out_target_exprs (TREE_OPERAND (t, 1)); } else if (TREE_CODE (t) == CALL_EXPR) { @@ -5964,7 +5964,7 @@ build_data_member_initialization (tree t, vec **vec) /* We don't use build_cplus_new here because it complains about abstract bases. Leaving the call unwrapped means that it has the wrong type, but cxx_eval_constant_expression doesn't care. */ - init = unshare_expr (t); + init = break_out_target_exprs (t); } else if (TREE_CODE (t) == DECL_EXPR) /* Declaring a temporary, don't add it to the CONSTRUCTOR. */ @@ -6201,7 +6201,7 @@ constexpr_fn_retval (tree body) } case RETURN_EXPR: - return unshare_expr (TREE_OPERAND (body, 0)); + return break_out_target_exprs (TREE_OPERAND (body, 0)); case DECL_EXPR: if (TREE_CODE (DECL_EXPR_DECL (body)) == USING_DECL) diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C new file mode 100644 index 00000000000..1fc3738554e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-value4.C @@ -0,0 +1,16 @@ +// PR c++/57901 +// { dg-require-effective-target c++11 } + +struct Z { + Z() = default; + Z(Z const&) = default; + constexpr Z(Z&&) {} /* non-trivial (constexpr) move ctor */ +}; + +template +constexpr int fn0(T v) { return 0; } +template +constexpr int fn (T v) { return fn0(v); } + +constexpr auto t0 = fn0(Z()); // OK! +constexpr auto t = fn (Z()); // error! (GCC 4.8.1) -- cgit v1.2.3 From f86ae0a1cde5dab0a459ddcae01c1c712cd7fe58 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 31 Jul 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201356 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0989d23cbee..f16969442a6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130730 +20130731 -- cgit v1.2.3 From 6b3baf4eb7d3caafa3bc0eca9c8729d594847864 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 31 Jul 2013 07:24:06 +0000 Subject: 2013-07-31 Andreas Krebbel Backport from mainline 2013-03-27 Andreas Krebbel * config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Define. 2013-07-23 Andreas Krebbel * config/s390/linux-unwind.h: Use the proper dwarf to hard reg mapping for FPRs when creating the fallback framestate. 2013-07-29 Dominik Vogt * config/s390/s390.md ("movcc"): Swap load and store instructions. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201363 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/config/s390/s390.h | 5 +++++ gcc/config/s390/s390.md | 12 ++++++------ libgcc/config/s390/linux-unwind.h | 4 +++- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03d681a02c9..02548443efc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2013-07-31 Andreas Krebbel + + Backport from mainline + 2013-03-27 Andreas Krebbel + + * config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Define. + + 2013-07-23 Andreas Krebbel + + * config/s390/linux-unwind.h: Use the proper dwarf to hard reg + mapping for FPRs when creating the fallback framestate. + + 2013-07-29 Dominik Vogt + + * config/s390/s390.md ("movcc"): Swap load and store instructions. + 2013-07-25 Terry Guo Backport from mainline: diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index bd0bc232a5d..43e24d5d112 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -164,6 +164,11 @@ enum processor_flags #define S390_TDC_INFINITY (S390_TDC_POSITIVE_INFINITY \ | S390_TDC_NEGATIVE_INFINITY ) +/* This is used by float.h to define the float_t and double_t data + types. For historical reasons both are double on s390 what cannot + be changed anymore. */ +#define TARGET_FLT_EVAL_METHOD 1 + /* Target machine storage layout. */ /* Everything is big-endian. */ diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index cad4f5f579a..d68613960ba 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -2252,13 +2252,13 @@ lr\t%0,%1 tmh\t%1,12288 ipm\t%0 - st\t%0,%1 - sty\t%0,%1 - l\t%1,%0 - ly\t%1,%0" + l\t%0,%1 + ly\t%0,%1 + st\t%1,%0 + sty\t%1,%0" [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY") - (set_attr "type" "lr,*,*,store,store,load,load") - (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_rec,z10_rec,z10_fwd_A3,z10_fwd_A3") + (set_attr "type" "lr,*,*,load,load,store,store") + (set_attr "z10prop" "z10_fr_E1,z10_super,*,z10_fwd_A3,z10_fwd_A3,z10_rec,z10_rec") (set_attr "z196prop" "*,*,z196_ends,*,*,*,*")]) ; diff --git a/libgcc/config/s390/linux-unwind.h b/libgcc/config/s390/linux-unwind.h index e497ce38d3a..68609169707 100644 --- a/libgcc/config/s390/linux-unwind.h +++ b/libgcc/config/s390/linux-unwind.h @@ -31,6 +31,8 @@ static _Unwind_Reason_Code s390_fallback_frame_state (struct _Unwind_Context *context, _Unwind_FrameState *fs) { + static const unsigned char dwarf_to_fpr_map[16] = + { 0, 2, 4, 6, 1, 3, 5, 7, 8, 10, 12, 14, 9, 11, 13, 15 }; unsigned char *pc = context->ra; long new_cfa; int i; @@ -112,7 +114,7 @@ s390_fallback_frame_state (struct _Unwind_Context *context, { fs->regs.reg[16+i].how = REG_SAVED_OFFSET; fs->regs.reg[16+i].loc.offset = - (long)®s->fprs[i] - new_cfa; + (long)®s->fprs[dwarf_to_fpr_map[i]] - new_cfa; } /* Load return addr from PSW into dummy register 32. */ -- cgit v1.2.3 From e8561a5486c820cd93eaa10b89c477bb583deab5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 31 Jul 2013 12:59:09 +0000 Subject: 2013-07-31 Sebastian Huber * config.gcc (*-*-rtems*): Use __cxa_atexit by default. * config/rs6000/rtems.h (TARGET_LIBGCC_SDATA_SECTION): Define. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201371 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config.gcc | 1 + gcc/config/rs6000/rtems.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 02548443efc..947ae4786b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-07-31 Sebastian Huber + + * config.gcc (*-*-rtems*): Use __cxa_atexit by default. + * config/rs6000/rtems.h (TARGET_LIBGCC_SDATA_SECTION): Define. + 2013-07-31 Andreas Krebbel Backport from mainline diff --git a/gcc/config.gcc b/gcc/config.gcc index a92796402ca..1648dfeaba0 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -734,6 +734,7 @@ case ${target} in yes) thread_file='rtems' ;; esac extra_options="${extra_options} rtems.opt" + default_use_cxa_atexit=yes use_gcc_stdint=wrap ;; *-*-uclinux*) diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h index b910b5ec5a2..fb22be1e8bb 100644 --- a/gcc/config/rs6000/rtems.h +++ b/gcc/config/rs6000/rtems.h @@ -34,6 +34,9 @@ } \ while (0) +#undef TARGET_LIBGCC_SDATA_SECTION +#define TARGET_LIBGCC_SDATA_SECTION ".sdata" + #undef CPP_OS_DEFAULT_SPEC #define CPP_OS_DEFAULT_SPEC "%(cpp_os_rtems)" -- cgit v1.2.3 From 2b1da6217d4202997b6389f85f5edc8b0568bfca Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 31 Jul 2013 14:36:35 +0000 Subject: 2013-07-31 Paolo Carlini PR libstdc++/56627 * include/bits/stl_bvector.h: Use friend struct hash intead of friend class hash to work around useless warnings produced by some compilers. * include/std/bitset: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201378 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/stl_bvector.h | 2 +- libstdc++-v3/include/std/bitset | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e503687e073..e187a75eac9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-07-31 Paolo Carlini + + PR libstdc++/56627 + * include/bits/stl_bvector.h: Use friend struct hash intead of + friend class hash to work around useless warnings produced by + some compilers. + * include/std/bitset: Likewise. + 2013-07-29 Paolo Carlini Revert last commit. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 670b19502af..422a98ac46f 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -520,7 +520,7 @@ template typedef _Bvector_base<_Alloc> _Base; #if __cplusplus >= 201103L - template friend class hash; + template friend struct hash; #endif public: diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 08ba2cd3857..1da6baf332f 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -760,7 +760,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #if __cplusplus >= 201103L - template friend class hash; + template friend struct hash; #endif public: -- cgit v1.2.3 -- cgit v1.2.3 From 3e8cbef7eeb0f38ae04a46c8d2dfc6c9d14c5372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Wed, 31 Jul 2013 19:29:13 +0000 Subject: =?UTF-8?q?2013-07-31=20=20Fran=C3=A7ois=20Dumont=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * include/profile/unordered_base.h: New. * include/Makefile.am: Add new profile header. * include/Makefile.in: Regenerate. * include/profile/impl/profiler.h (__profcxx_inefficient_hash_is_on): New macro. * include/profile/unordered_map (std::profile::unordered_map<>): Use new _Unordered_profile base class. Use default implementations for special functions. (std::profile::unordered_multimap<>): Likewise. * include/profile/unordered_set (std::profile::unordered_set<>): Likewise. (std::profile::unordered_multiset<>): Likewise. * testsuite/23_containers/unordered_multiset/55043.cc: Fix MoveOnly equality operator signature. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201383 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 17 ++ libstdc++-v3/include/Makefile.am | 1 + libstdc++-v3/include/Makefile.in | 1 + libstdc++-v3/include/profile/impl/profiler.h | 9 +- libstdc++-v3/include/profile/unordered_base.h | 262 +++++++++++++++++++++ libstdc++-v3/include/profile/unordered_map | 237 +++++-------------- libstdc++-v3/include/profile/unordered_set | 227 +++++------------- .../23_containers/unordered_multiset/55043.cc | 2 +- 8 files changed, 404 insertions(+), 352 deletions(-) create mode 100644 libstdc++-v3/include/profile/unordered_base.h diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e187a75eac9..cdab3e72cd1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2013-07-31 François Dumont + + * include/profile/unordered_base.h: New. + * include/Makefile.am: Add new profile header. + * include/Makefile.in: Regenerate. + * include/profile/impl/profiler.h + (__profcxx_inefficient_hash_is_on): New macro. + * include/profile/unordered_map (std::profile::unordered_map<>): + Use new _Unordered_profile base class. Use default implementations + for special functions. + (std::profile::unordered_multimap<>): Likewise. + * include/profile/unordered_set (std::profile::unordered_set<>): + Likewise. + (std::profile::unordered_multiset<>): Likewise. + * testsuite/23_containers/unordered_multiset/55043.cc: Fix + MoveOnly equality operator signature. + 2013-07-31 Paolo Carlini PR libstdc++/56627 diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 16f8342c380..2dfc8dcf462 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -785,6 +785,7 @@ profile_builddir = ./profile profile_headers = \ ${profile_srcdir}/array \ ${profile_srcdir}/base.h \ + ${profile_srcdir}/unordered_base.h \ ${profile_srcdir}/unordered_map \ ${profile_srcdir}/unordered_set \ ${profile_srcdir}/vector \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 5b8a2064f1f..d16ca12ac76 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -1042,6 +1042,7 @@ profile_builddir = ./profile profile_headers = \ ${profile_srcdir}/array \ ${profile_srcdir}/base.h \ + ${profile_srcdir}/unordered_base.h \ ${profile_srcdir}/unordered_map \ ${profile_srcdir}/unordered_set \ ${profile_srcdir}/vector \ diff --git a/libstdc++-v3/include/profile/impl/profiler.h b/libstdc++-v3/include/profile/impl/profiler.h index d8019cb313f..081bb64ba96 100644 --- a/libstdc++-v3/include/profile/impl/profiler.h +++ b/libstdc++-v3/include/profile/impl/profiler.h @@ -188,7 +188,7 @@ namespace __gnu_profile _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_invalid()) #define __profcxx_is_on() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_on()) -#define __profcxx__is_off() \ +#define __profcxx_is_off() \ _GLIBCXX_PROFILE_REENTRANCE_GUARD(__gnu_profile::__is_off()) #else #define __profcxx_report() @@ -237,6 +237,8 @@ namespace __gnu_profile // Turn on/off instrumentation for INEFFICIENT_HASH. #if defined(_GLIBCXX_PROFILE_INEFFICIENT_HASH) +#define __profcxx_inefficient_hash_is_on() \ + __gnu_profile::__is_on() #define __profcxx_hashtable_construct2(__x...) \ _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hash_func_construct(__x)) @@ -244,8 +246,9 @@ namespace __gnu_profile _GLIBCXX_PROFILE_REENTRANCE_GUARD( \ __gnu_profile::__trace_hash_func_destruct(__x)) #else -#define __profcxx_hashtable_destruct2(__x...) -#define __profcxx_hashtable_construct2(__x...) +#define __profcxx_inefficient_hash_is_on() false +#define __profcxx_hashtable_destruct2(__x...) +#define __profcxx_hashtable_construct2(__x...) #endif // Turn on/off instrumentation for VECTOR_TO_LIST. diff --git a/libstdc++-v3/include/profile/unordered_base.h b/libstdc++-v3/include/profile/unordered_base.h new file mode 100644 index 00000000000..0994212de80 --- /dev/null +++ b/libstdc++-v3/include/profile/unordered_base.h @@ -0,0 +1,262 @@ +// Profiling unordered containers implementation details -*- C++ -*- + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +/** @file profile/unordered_base.h + * This file is a GNU profile extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_PROFILE_UNORDERED +#define _GLIBCXX_PROFILE_UNORDERED 1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __profile +{ + template + struct _Bucket_index_helper; + + template + struct _Bucket_index_helper<_UnorderedCont, _Value, true> + { + static std::size_t + bucket(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, true>* __node) + { return __node->_M_hash_code % __uc.bucket_count(); } + }; + + template + struct _Bucket_index_helper<_UnorderedCont, _Value, false> + { + static std::size_t + bucket(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, false>* __node) + { return __uc.bucket(__node->_M_v); } + }; + + template + struct _Bucket_index_helper<_UnorderedCont, + std::pair, false> + { + typedef std::pair _Value; + + static std::size_t + bucket(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, false>* __node) + { return __uc.bucket(__node->_M_v.first); } + }; + + template + std::size_t + __get_bucket_index(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, _Cache_hash_code>* __node) + { + using __bucket_index_helper + = _Bucket_index_helper<_UnorderedCont, _Value, _Cache_hash_code>; + return __bucket_index_helper::bucket(__uc, __node); + } + + template + struct _Equal_helper; + + template + struct _Equal_helper<_UnorderedCont, _Value, true> + { + static std::size_t + are_equal(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, true>* __lhs, + const __detail::_Hash_node<_Value, true>* __rhs) + { + return __lhs->_M_hash_code == __rhs->_M_hash_code + && __uc.key_eq()(__lhs->_M_v, __rhs->_M_v); + } + }; + + template + struct _Equal_helper<_UnorderedCont, _Value, false> + { + static std::size_t + are_equal(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, false>* __lhs, + const __detail::_Hash_node<_Value, false>* __rhs) + { return __uc.key_eq()(__lhs->_M_v, __rhs->_M_v); } + }; + + template + struct _Equal_helper<_UnorderedCont, std::pair, true> + { + typedef std::pair _Value; + + static std::size_t + are_equal(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, true>* __lhs, + const __detail::_Hash_node<_Value, true>* __rhs) + { + return __lhs->_M_hash_code == __rhs->_M_hash_code + && __uc.key_eq()(__lhs->_M_v.first, __rhs->_M_v.first); + } + }; + + template + struct _Equal_helper<_UnorderedCont, std::pair, false> + { + typedef std::pair _Value; + + static std::size_t + are_equal(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, false>* __lhs, + const __detail::_Hash_node<_Value, false>* __rhs) + { return __uc.key_eq()(__lhs->_M_v.first, __rhs->_M_v.first); } + }; + + template + bool + __are_equal(const _UnorderedCont& __uc, + const __detail::_Hash_node<_Value, _Cache_hash_code>* __lhs, + const __detail::_Hash_node<_Value, _Cache_hash_code>* __rhs) + { + using __equal_helper + = _Equal_helper<_UnorderedCont, _Value, _Cache_hash_code>; + return __equal_helper::are_equal(__uc, __lhs, __rhs); + } + + template + class _Unordered_profile + { + _UnorderedCont& + _M_conjure() + { return *(static_cast<_UnorderedCont*>(this)); } + + using __unique_keys = std::integral_constant; + + protected: + _Unordered_profile() + { + auto& __uc = _M_conjure(); + __profcxx_hashtable_construct(&__uc, __uc.bucket_count()); + __profcxx_hashtable_construct2(&__uc); + } + _Unordered_profile(const _Unordered_profile&) + : _Unordered_profile() { } + _Unordered_profile(_Unordered_profile&&) + : _Unordered_profile() { } + + ~_Unordered_profile() noexcept + { + auto& __uc = _M_conjure(); + __profcxx_hashtable_destruct(&__uc, __uc.bucket_count(), __uc.size()); + _M_profile_destruct(); + } + + _Unordered_profile& + operator=(const _Unordered_profile&) = default; + + _Unordered_profile& + operator=(_Unordered_profile&&) = default; + + void + _M_profile_destruct() + { + if (!__profcxx_inefficient_hash_is_on()) + return; + + _M_profile_destruct(__unique_keys()); + } + + private: + void + _M_profile_destruct(std::true_type); + + void + _M_profile_destruct(std::false_type); + }; + + template + void + _Unordered_profile<_UnorderedCont, _Unique_keys>:: + _M_profile_destruct(std::true_type) + { + auto& __uc = _M_conjure(); + std::size_t __hops = 0, __lc = 0, __chain = 0; + auto __it = __uc.begin(); + while (__it != __uc.end()) + { + auto __bkt = __get_bucket_index(__uc, __it._M_cur); + auto __lit = __uc.begin(__bkt); + auto __lend = __uc.end(__bkt); + for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) + ++__chain; + if (__chain) + { + ++__chain; + __lc = __lc > __chain ? __lc : __chain; + __hops += __chain * (__chain - 1) / 2; + __chain = 0; + } + } + __profcxx_hashtable_destruct2(&__uc, __lc, __uc.size(), __hops); + } + + template + void + _Unordered_profile<_UnorderedCont, _Unique_keys>:: + _M_profile_destruct(std::false_type) + { + auto& __uc = _M_conjure(); + std::size_t __hops = 0, __lc = 0, __chain = 0, __unique_size = 0; + auto __it = __uc.begin(); + while (__it != __uc.end()) + { + auto __bkt = __get_bucket_index(__uc, __it._M_cur); + auto __lit = __uc.begin(__bkt); + auto __lend = __uc.end(__bkt); + auto __pit = __it; + ++__unique_size; + for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) + { + if (!__are_equal(__uc, __pit._M_cur, __it._M_cur)) + { + ++__chain; + ++__unique_size; + __pit = __it; + } + } + if (__chain) + { + ++__chain; + __lc = __lc > __chain ? __lc : __chain; + __hops += __chain * (__chain - 1) / 2; + __chain = 0; + } + } + __profcxx_hashtable_destruct2(&__uc, __lc, __unique_size, __hops); + } + +} // namespace __profile +} // namespace std + +#endif diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map index 0fee176e14a..e9b94033a7a 100644 --- a/libstdc++-v3/include/profile/unordered_map +++ b/libstdc++-v3/include/profile/unordered_map @@ -34,6 +34,7 @@ # include #include +#include #define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE @@ -44,14 +45,22 @@ namespace __profile { /// Class std::unordered_map wrapper with performance instrumentation. template, + typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator<_Key> > + typename _Alloc = std::allocator > > class unordered_map - : public _GLIBCXX_STD_BASE + : public _GLIBCXX_STD_BASE, + public _Unordered_profile, + true> { typedef typename _GLIBCXX_STD_BASE _Base; + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; @@ -72,11 +81,8 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__n, __hf, __eql, __a) + { } template unordered_map(_InputIterator __f, _InputIterator __l, @@ -84,85 +90,45 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__f, __l, __n, __hf, __eql, __a) + { } - unordered_map(const unordered_map& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_map(const unordered_map&) = default; unordered_map(const _Base& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__x) + { } - unordered_map(unordered_map&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_map(unordered_map&&) = default; unordered_map(initializer_list __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } + : _Base(__l, __n, __hf, __eql, __a) + { } unordered_map& - operator=(const unordered_map& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_map&) = default; unordered_map& - operator=(unordered_map&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_map&&) = default; unordered_map& operator=(initializer_list __l) { - this->clear(); - this->insert(__l); + _M_base() = __l; return *this; } - ~unordered_map() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - - _Base& - _M_base() noexcept { return *this; } - - const _Base& - _M_base() const noexcept { return *this; } - void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); - _M_profile_destruct(); - _Base::clear(); + this->_M_profile_destruct(); + _Base::clear(); } template @@ -247,14 +213,6 @@ namespace __profile _M_profile_resize(__old_size); } - void - insert(const value_type* __first, const value_type* __last) - { - size_type __old_size = _Base::bucket_count(); - _Base::insert(__first, __last); - _M_profile_resize(__old_size); - } - // operator[] mapped_type& operator[](const _Key& __k) @@ -276,7 +234,7 @@ namespace __profile void swap(unordered_map& __x) - { _Base::swap(__x); } + { _Base::swap(__x._M_base()); } void rehash(size_type __n) { @@ -293,29 +251,6 @@ namespace __profile if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } - - void - _M_profile_destruct() - { - size_type __hops = 0, __lc = 0, __chain = 0; - iterator __it = this->begin(); - while (__it != this->end()) - { - size_type __bkt = this->bucket(__it->first); - auto __lit = this->begin(__bkt); - auto __lend = this->end(__bkt); - for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) - ++__chain; - if (__chain) - { - ++__chain; - __lc = __lc > __chain ? __lc : __chain; - __hops += __chain * (__chain - 1) / 2; - __chain = 0; - } - } - __profcxx_hashtable_destruct2(this, __lc, _Base::size(), __hops); - } }; template, + typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, - typename _Alloc = std::allocator<_Key> > + typename _Alloc = std::allocator > > class unordered_multimap - : public _GLIBCXX_STD_BASE + : public _GLIBCXX_STD_BASE, + public _Unordered_profile, + false> { typedef typename _GLIBCXX_STD_BASE _Base; + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; @@ -373,85 +317,54 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__n, __hf, __eql, __a) + { } + template unordered_multimap(_InputIterator __f, _InputIterator __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__f, __l, __n, __hf, __eql, __a) + { } - unordered_multimap(const unordered_multimap& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multimap(const unordered_multimap&) = default; unordered_multimap(const _Base& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__x) + { } - unordered_multimap(unordered_multimap&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multimap(unordered_multimap&&) = default; unordered_multimap(initializer_list __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } + : _Base(__l, __n, __hf, __eql, __a) + { } unordered_multimap& - operator=(const unordered_multimap& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_multimap&) = default; unordered_multimap& - operator=(unordered_multimap&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_multimap&&) = default; unordered_multimap& operator=(initializer_list __l) { - this->clear(); - this->insert(__l); + _M_base() = __l; return *this; } - ~unordered_multimap() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void clear() noexcept { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), + __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); - _M_profile_destruct(); - _Base::clear(); + this->_M_profile_destruct(); + _Base::clear(); } template @@ -535,19 +448,12 @@ namespace __profile _M_profile_resize(__old_size); } - void - insert(const value_type* __first, const value_type* __last) - { - size_type __old_size = _Base::bucket_count(); - _Base::insert(__first, __last); - _M_profile_resize(__old_size); - } - void swap(unordered_multimap& __x) - { _Base::swap(__x); } + { _Base::swap(__x._M_base()); } - void rehash(size_type __n) + void + rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); @@ -562,29 +468,6 @@ namespace __profile if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } - - void - _M_profile_destruct() - { - size_type __hops = 0, __lc = 0, __chain = 0; - iterator __it = this->begin(); - while (__it != this->end()) - { - size_type __bkt = this->bucket(__it->first); - auto __lit = this->begin(__bkt); - auto __lend = this->end(__bkt); - for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) - ++__chain; - if (__chain) - { - ++__chain; - __lc = __lc > __chain ? __lc : __chain; - __hops += __chain * (__chain - 1) / 2; - __chain = 0; - } - } - __profcxx_hashtable_destruct2(this, __lc, _Base::size(), __hops); - } }; template #include +#include #define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc> #define _GLIBCXX_STD_BASE _GLIBCXX_STD_C::_GLIBCXX_BASE @@ -44,14 +45,22 @@ namespace __profile { /** @brief Unordered_set wrapper with performance instrumentation. */ template, + typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>, typename _Alloc = std::allocator<_Key> > class unordered_set - : public _GLIBCXX_STD_BASE + : public _GLIBCXX_STD_BASE, + public _Unordered_profile, + true> { typedef _GLIBCXX_STD_BASE _Base; + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; @@ -71,11 +80,8 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__n, __hf, __eql, __a) + { } template unordered_set(_InputIterator __f, _InputIterator __l, @@ -83,84 +89,48 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__f, __l, __n, __hf, __eql, __a) + { } - unordered_set(const unordered_set& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_set(const unordered_set&) = default; unordered_set(const _Base& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + : _Base(__x) + { } - unordered_set(unordered_set&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - __profcxx_hashtable_construct2(this); - } + unordered_set(unordered_set&&) = default; unordered_set(initializer_list __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } + : _Base(__l, __n, __hf, __eql, __a) + { } unordered_set& - operator=(const unordered_set& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_set&) = default; unordered_set& - operator=(unordered_set&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_set&&) = default; unordered_set& operator=(initializer_list __l) { - this->clear(); - this->insert(__l); + _M_base() = __l; return *this; } - ~unordered_set() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void swap(unordered_set& __x) - { - _Base::swap(__x); - } + { _Base::swap(__x); } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); - _M_profile_destruct(); + this->_M_profile_destruct(); _Base::clear(); } @@ -240,14 +210,7 @@ namespace __profile } void - insert(const value_type* __first, const value_type* __last) - { - size_type __old_size = _Base::bucket_count(); - _Base::insert(__first, __last); - _M_profile_resize(__old_size); - } - - void rehash(size_type __n) + rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); @@ -262,29 +225,6 @@ namespace __profile if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } - - void - _M_profile_destruct() - { - size_type __hops = 0, __lc = 0, __chain = 0; - iterator __it = this->begin(); - while (__it != this->end()) - { - size_type __bkt = this->bucket(*__it); - auto __lit = this->begin(__bkt); - auto __lend = this->end(__bkt); - for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) - ++__chain; - if (__chain) - { - ++__chain; - __lc = __lc > __chain ? __lc : __chain; - __hops += __chain * (__chain - 1) / 2; - __chain = 0; - } - } - __profcxx_hashtable_destruct2(this, __lc, _Base::size(), __hops); - } }; template @@ -312,14 +252,23 @@ namespace __profile /** @brief Unordered_multiset wrapper with performance instrumentation. */ template, - typename _Pred = std::equal_to<_Value>, - typename _Alloc = std::allocator<_Value> > + typename _Hash = std::hash<_Value>, + typename _Pred = std::equal_to<_Value>, + typename _Alloc = std::allocator<_Value> > class unordered_multiset - : public _GLIBCXX_STD_BASE + : public _GLIBCXX_STD_BASE, + public _Unordered_profile, + false> { typedef _GLIBCXX_STD_BASE _Base; + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + public: typedef typename _Base::size_type size_type; typedef typename _Base::hasher hasher; @@ -339,10 +288,8 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__n, __hf, __eql, __a) + { } template unordered_multiset(_InputIterator __f, _InputIterator __l, @@ -350,80 +297,48 @@ namespace __profile const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__f, __l, __n, __hf, __eql, __a) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__f, __l, __n, __hf, __eql, __a) + { } - unordered_multiset(const unordered_multiset& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multiset(const unordered_multiset&) = default; unordered_multiset(const _Base& __x) - : _Base(__x) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + : _Base(__x) + { } - unordered_multiset(unordered_multiset&& __x) - : _Base(std::move(__x)) - { - __profcxx_hashtable_construct(this, _Base::bucket_count()); - } + unordered_multiset(unordered_multiset&&) = default; unordered_multiset(initializer_list __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) - : _Base(__l, __n, __hf, __eql, __a) { } + : _Base(__l, __n, __hf, __eql, __a) + { } unordered_multiset& - operator=(const unordered_multiset& __x) - { - *static_cast<_Base*>(this) = __x; - return *this; - } + operator=(const unordered_multiset&) = default; unordered_multiset& - operator=(unordered_multiset&& __x) - { - // NB: DR 1204. - // NB: DR 675. - this->clear(); - this->swap(__x); - return *this; - } + operator=(unordered_multiset&&) = default; unordered_multiset& operator=(initializer_list __l) { - this->clear(); - this->insert(__l); + _M_base() = __l; return *this; } - ~unordered_multiset() noexcept - { - __profcxx_hashtable_destruct(this, _Base::bucket_count(), - _Base::size()); - _M_profile_destruct(); - } - void swap(unordered_multiset& __x) - { - _Base::swap(__x); - } + { _Base::swap(__x); } void clear() noexcept { __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size()); - _M_profile_destruct(); + this->_M_profile_destruct(); _Base::clear(); } @@ -502,14 +417,7 @@ namespace __profile } void - insert(const value_type* __first, const value_type* __last) - { - size_type __old_size = _Base::bucket_count(); - _Base::insert(__first, __last); - _M_profile_resize(__old_size); - } - - void rehash(size_type __n) + rehash(size_type __n) { size_type __old_size = _Base::bucket_count(); _Base::rehash(__n); @@ -524,29 +432,6 @@ namespace __profile if (__old_size != __new_size) __profcxx_hashtable_resize(this, __old_size, __new_size); } - - void - _M_profile_destruct() - { - size_type __hops = 0, __lc = 0, __chain = 0; - iterator __it = this->begin(); - while (__it != this->end()) - { - size_type __bkt = this->bucket(*__it); - auto __lit = this->begin(__bkt); - auto __lend = this->end(__bkt); - for (++__it, ++__lit; __lit != __lend; ++__it, ++__lit) - ++__chain; - if (__chain) - { - ++__chain; - __lc = __lc > __chain ? __lc : __chain; - __hops += __chain * (__chain - 1) / 2; - __chain = 0; - } - } - __profcxx_hashtable_destruct2(this, __lc, _Base::size(), __hops); - } }; template diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc index 9d71cff8583..c80ce55cb7c 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/55043.cc @@ -30,7 +30,7 @@ struct MoveOnly }; struct equal { - bool operator()(const MoveOnly&, const MoveOnly) const { return true; } + bool operator()(const MoveOnly&, const MoveOnly&) const { return true; } }; struct hash { std::size_t operator()(const MoveOnly&) const { return 0; } -- cgit v1.2.3 From 619863042b832bd9d781cfb47091870441372ad7 Mon Sep 17 00:00:00 2001 From: Sriraman Tallam Date: Wed, 31 Jul 2013 20:11:51 +0000 Subject: PR 57362 PR target/57362 * config/i386/i386.c (dispatch_function_versions): Fix array indexing of function_version_info to match actual_versions. PR target/57362 * g++.dg/ext/pr57362.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201388 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 + gcc/config/i386/i386.c | 7 +- gcc/testsuite/g++.dg/ext/pr57362.C | 199 +++++++++++++++++++++++++++++++++++++ 3 files changed, 208 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/pr57362.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 947ae4786b8..7075bf081fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-07-31 Sriraman Tallam + + * config/i386/i386.c (dispatch_function_versions): Fix array + indexing of function_version_info to match actual_versions. + 2013-07-31 Sebastian Huber * config.gcc (*-*-rtems*): Use __cxa_atexit by default. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 954fc258a88..f0a77974e85 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -28937,10 +28937,11 @@ dispatch_function_versions (tree dispatch_decl, if (predicate_chain == NULL_TREE) continue; + function_version_info [actual_versions].version_decl = version_decl; + function_version_info [actual_versions].predicate_chain + = predicate_chain; + function_version_info [actual_versions].dispatch_priority = priority; actual_versions++; - function_version_info [ix - 1].version_decl = version_decl; - function_version_info [ix - 1].predicate_chain = predicate_chain; - function_version_info [ix - 1].dispatch_priority = priority; } /* Sort the versions according to descending order of dispatch priority. The diff --git a/gcc/testsuite/g++.dg/ext/pr57362.C b/gcc/testsuite/g++.dg/ext/pr57362.C new file mode 100644 index 00000000000..67f96857e8d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr57362.C @@ -0,0 +1,199 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-ifunc "" } */ + +__attribute__((target("default"))) +int foo(void) { return 1; } +__attribute__((target("128bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("80387"))) +int foo(void) { return 1; } +__attribute__((target("96bit-long-double"))) +int foo(void) { return 1; } +__attribute__((target("long-double-80"))) +int foo(void) { return 1; } +__attribute__((target("long-double-64"))) +int foo(void) { return 1; } +__attribute__((target("accumulate-outgoing-args"))) +int foo(void) { return 1; } +__attribute__((target("align-double"))) +int foo(void) { return 1; } +__attribute__((target("align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("force-drap"))) +int foo(void) { return 1; } +__attribute__((target("fp-ret-in-387"))) +int foo(void) { return 1; } +__attribute__((target("hard-float"))) +int foo(void) { return 1; } +__attribute__((target("ieee-fp"))) +int foo(void) { return 1; } +__attribute__((target("inline-all-stringops"))) +int foo(void) { return 1; } +__attribute__((target("inline-stringops-dynamically"))) +int foo(void) { return 1; } +__attribute__((target("intel-syntax"))) +int foo(void) { return 1; } +__attribute__((target("ms-bitfields"))) +int foo(void) { return 1; } +__attribute__((target("no-align-stringops"))) +int foo(void) { return 1; } +__attribute__((target("no-fancy-math-387"))) +int foo(void) { return 1; } +__attribute__((target("no-push-args"))) +int foo(void) { return 1; } +__attribute__((target("no-red-zone"))) +int foo(void) { return 1; } +__attribute__((target("omit-leaf-frame-pointer"))) +int foo(void) { return 1; } +__attribute__((target("pc32"))) +int foo(void) { return 1; } +__attribute__((target("pc64"))) +int foo(void) { return 1; } +__attribute__((target("pc80"))) +int foo(void) { return 1; } +__attribute__((target("push-args"))) +int foo(void) { return 1; } +__attribute__((target("red-zone"))) +int foo(void) { return 1; } +__attribute__((target("rtd"))) +int foo(void) { return 1; } +__attribute__((target("soft-float"))) +int foo(void) { return 1; } +__attribute__((target("sseregparm"))) +int foo(void) { return 1; } +__attribute__((target("stackrealign"))) +int foo(void) { return 1; } +__attribute__((target("stack-arg-probe"))) +int foo(void) { return 1; } +__attribute__((target("tls-direct-seg-refs"))) +int foo(void) { return 1; } +__attribute__((target("vect8-ret-in-mem"))) +int foo(void) { return 1; } +__attribute__((target("recip"))) +int foo(void) { return 1; } +__attribute__((target("cld"))) +int foo(void) { return 1; } +__attribute__((target("vzeroupper"))) +int foo(void) { return 1; } +__attribute__((target("dispatch-scheduler"))) +int foo(void) { return 1; } +__attribute__((target("prefer-avx128"))) +int foo(void) { return 1; } +__attribute__((target("32"))) +int foo(void) { return 1; } +__attribute__((target("64"))) +int foo(void) { return 1; } +__attribute__((target("x32"))) +int foo(void) { return 1; } +__attribute__((target("mmx"))) +int foo(void) { return 1; } +__attribute__((target("3dnow"))) +int foo(void) { return 1; } +__attribute__((target("3dnowa"))) +int foo(void) { return 1; } +__attribute__((target("sse"))) +int foo(void) { return 1; } +__attribute__((target("sse2"))) +int foo(void) { return 1; } +__attribute__((target("sse3"))) +int foo(void) { return 1; } +__attribute__((target("ssse3"))) +int foo(void) { return 1; } +__attribute__((target("sse4.1"))) +int foo(void) { return 1; } +__attribute__((target("sse4.2"))) +int foo(void) { return 1; } +__attribute__((target("sse4"))) +int foo(void) { return 1; } +__attribute__((target("no-sse4"))) +int foo(void) { return 1; } +__attribute__((target("sse5"))) +int foo(void) { return 1; } +__attribute__((target("avx"))) +int foo(void) { return 1; } +__attribute__((target("avx2"))) +int foo(void) { return 1; } +__attribute__((target("fma"))) +int foo(void) { return 1; } +__attribute__((target("sse4a"))) +int foo(void) { return 1; } +__attribute__((target("fma4"))) +int foo(void) { return 1; } +__attribute__((target("xop"))) +int foo(void) { return 1; } +__attribute__((target("lwp"))) +int foo(void) { return 1; } +__attribute__((target("abm"))) +int foo(void) { return 1; } +__attribute__((target("popcnt"))) +int foo(void) { return 1; } +__attribute__((target("bmi"))) +int foo(void) { return 1; } +__attribute__((target("bmi2"))) +int foo(void) { return 1; } +__attribute__((target("lzcnt"))) +int foo(void) { return 1; } +__attribute__((target("hle"))) +int foo(void) { return 1; } +__attribute__((target("rdseed"))) +int foo(void) { return 1; } +__attribute__((target("prfchw"))) +int foo(void) { return 1; } +__attribute__((target("adx"))) +int foo(void) { return 1; } +__attribute__((target("fxsr"))) +int foo(void) { return 1; } +__attribute__((target("xsave"))) +int foo(void) { return 1; } +__attribute__((target("xsaveopt"))) +int foo(void) { return 1; } +__attribute__((target("tbm"))) +int foo(void) { return 1; } +__attribute__((target("cx16"))) +int foo(void) { return 1; } +__attribute__((target("sahf"))) +int foo(void) { return 1; } +__attribute__((target("movbe"))) +int foo(void) { return 1; } +__attribute__((target("crc32"))) +int foo(void) { return 1; } +__attribute__((target("aes"))) +int foo(void) { return 1; } +__attribute__((target("pclmul"))) +int foo(void) { return 1; } +__attribute__((target("sse2avx"))) +int foo(void) { return 1; } +__attribute__((target("fsgsbase"))) +int foo(void) { return 1; } +__attribute__((target("rdrnd"))) +int foo(void) { return 1; } +__attribute__((target("f16c"))) +int foo(void) { return 1; } +__attribute__((target("fentry"))) +int foo(void) { return 1; } +__attribute__((target("8bit-idiv"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-load"))) +int foo(void) { return 1; } +__attribute__((target("avx256-split-unaligned-store"))) +int foo(void) { return 1; } +__attribute__((target("rtm"))) +int foo(void) { return 1; } +//--------------- + +#include + int main (void) + { + int result; + result = foo(); + printf("Result is %d\n", result); + return result; + } + +/* { dg-prune-output "attribute.* is unknown" } */ +/* { dg-prune-output "redefinition of int foo" } */ +/* { dg-prune-output "previous declaration of int foo" } */ +/* { dg-prune-output "int foo.* previously defined here" } */ +/* { dg-prune-output "No dispatcher found for" } */ -- cgit v1.2.3 From 377f319e5f1e7cd4449e631b94aa144ab0c4204b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 1 Aug 2013 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201396 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f16969442a6..a6294c5e77b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130731 +20130801 -- cgit v1.2.3 From ece7a76c3d3bf9494c663318fbc67e59fcb0c410 Mon Sep 17 00:00:00 2001 From: Ganesh Gopalasubramanian Date: Thu, 1 Aug 2013 10:52:07 +0000 Subject: Backport AMD specific default alignment changes from mainline git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201402 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7075bf081fc..b2001cb5f73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-01 Ganesh Gopalasubramanian + + Backport from mainline + 2013-05-13 Ganesh Gopalasubramanian + + + * config/i386/i386.c (processor_target_table): Modified default + alignment values for AMD BD and BT architectures. + 2013-07-31 Sriraman Tallam * config/i386/i386.c (dispatch_function_versions): Fix array diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f0a77974e85..5dab4f04abc 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2438,11 +2438,11 @@ static const struct ptt processor_target_table[PROCESSOR_max] = {&generic32_cost, 16, 7, 16, 7, 16}, {&generic64_cost, 16, 10, 16, 10, 16}, {&amdfam10_cost, 32, 24, 32, 7, 32}, - {&bdver1_cost, 32, 24, 32, 7, 32}, - {&bdver2_cost, 32, 24, 32, 7, 32}, - {&bdver3_cost, 32, 24, 32, 7, 32}, - {&btver1_cost, 32, 24, 32, 7, 32}, - {&btver2_cost, 32, 24, 32, 7, 32}, + {&bdver1_cost, 16, 10, 16, 7, 11}, + {&bdver2_cost, 16, 10, 16, 7, 11}, + {&bdver3_cost, 16, 10, 16, 7, 11}, + {&btver1_cost, 16, 10, 16, 7, 11}, + {&btver2_cost, 16, 10, 16, 7, 11}, {&atom_cost, 16, 15, 16, 7, 16} }; -- cgit v1.2.3 From a3628db923f54ee25a498ce551547dc1f098a35f Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Thu, 1 Aug 2013 21:15:18 +0000 Subject: Backport from trunk: Fix licenses on several libgcc files. * config/aarch64/sfp-machine.h, config/aarch64/sync-cache.c, * config/i386/cpuinfo.c, config/ia64/unwind-ia64.h, * config/mips/vr4120-div.S: Fix license from GPL-3.0+ to GPL-3.0-with-GCC-exception. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201418 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 9 +++++++++ libgcc/config/aarch64/sfp-machine.h | 35 ++++++++++++++++++++--------------- libgcc/config/aarch64/sync-cache.c | 29 +++++++++++++++++------------ libgcc/config/i386/cpuinfo.c | 11 ++++++++--- libgcc/config/ia64/unwind-ia64.h | 35 ++++++++++++++++++++--------------- libgcc/config/mips/vr4120-div.S | 25 +++++++++++++++---------- 6 files changed, 89 insertions(+), 55 deletions(-) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 39d288739d5..4ef529f27b7 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-01 Maxim Kuvyrkov + + Backport from trunk: Fix licenses on several libgcc files. + + * config/aarch64/sfp-machine.h, config/aarch64/sync-cache.c, + * config/i386/cpuinfo.c, config/ia64/unwind-ia64.h, + * config/mips/vr4120-div.S: Fix license from GPL-3.0+ to + GPL-3.0-with-GCC-exception. + 2013-07-19 Georg-Johann Lay Backport from 2013-07-19 trunk r201051. diff --git a/libgcc/config/aarch64/sfp-machine.h b/libgcc/config/aarch64/sfp-machine.h index 997730866d9..878a00422d6 100644 --- a/libgcc/config/aarch64/sfp-machine.h +++ b/libgcc/config/aarch64/sfp-machine.h @@ -2,21 +2,26 @@ Copyright (C) 2009-2013 Free Software Foundation, Inc. Contributed by ARM Ltd. - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ #define _FP_W_TYPE_SIZE 64 #define _FP_W_TYPE unsigned long diff --git a/libgcc/config/aarch64/sync-cache.c b/libgcc/config/aarch64/sync-cache.c index 3397e9d29b4..0899256ab9f 100644 --- a/libgcc/config/aarch64/sync-cache.c +++ b/libgcc/config/aarch64/sync-cache.c @@ -2,21 +2,26 @@ Copyright (C) 2012-2013 Free Software Foundation, Inc. Contributed by ARM Ltd. - This file is part of GCC. +This file is part of GCC. - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. - GCC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ void __aarch64_sync_cache_range (const void *, const void *); diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c index 0ad00740350..fa1545a6a53 100644 --- a/libgcc/config/i386/cpuinfo.c +++ b/libgcc/config/i386/cpuinfo.c @@ -14,9 +14,14 @@ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ #include "cpuid.h" #include "tsystem.h" diff --git a/libgcc/config/ia64/unwind-ia64.h b/libgcc/config/ia64/unwind-ia64.h index fb5a3c48fb0..644f81a2b2a 100644 --- a/libgcc/config/ia64/unwind-ia64.h +++ b/libgcc/config/ia64/unwind-ia64.h @@ -2,21 +2,26 @@ Contributed by Andrew MacLeod Andrew Haley - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ #ifdef __VMS__ /* On VMS, long is a 32 bit type. */ diff --git a/libgcc/config/mips/vr4120-div.S b/libgcc/config/mips/vr4120-div.S index 2b934624a87..6e9242a1e37 100644 --- a/libgcc/config/mips/vr4120-div.S +++ b/libgcc/config/mips/vr4120-div.S @@ -3,18 +3,23 @@ This file is part of GCC. -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. -You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ /* This file contains functions which implement divsi3 and modsi3 for -- cgit v1.2.3 From 072cbbce033e774d49c2e4533a4767925f410050 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 2 Aug 2013 00:16:35 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201422 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a6294c5e77b..65141bf210f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130801 +20130802 -- cgit v1.2.3 From cf118169db1a8da3a89439ca0ae615214572e1d0 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 2 Aug 2013 15:41:10 +0000 Subject: 2013-08-02 Andreas Krebbel Backports from mainline: 2013-06-27 Andreas Krebbel * config/s390/s390.c: Rename UNSPEC_CCU_TO_INT to UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. (struct machine_function): Add tbegin_p. (s390_canonicalize_comparison): Fold CC mode compares to conditional jump if possible. (s390_emit_jump): Return the emitted jump. (s390_branch_condition_mask, s390_branch_condition_mnemonic): Handle CCRAWmode compares. (s390_option_override): Default to -mhtm if available. (s390_reg_clobbered_rtx): Handle floating point regs as well. (s390_regs_ever_clobbered): Use s390_regs_ever_clobbered also for FPRs instead of df_regs_ever_live_p. (s390_optimize_nonescaping_tx): New function. (s390_init_frame_layout): Extend clobbered_regs array to cover FPRs as well. (s390_emit_prologue): Call s390_optimize_nonescaping_tx. (s390_expand_tbegin): New function. (enum s390_builtin): New enum definition. (code_for_builtin): New array definition. (s390_init_builtins): New function. (s390_expand_builtin): New function. (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. * common/config/s390/s390-common.c (processor_flags_table): Add PF_TX. * config/s390/predicates.md (s390_comparison): Handle CCRAWmode. (s390_alc_comparison): Likewise. * config/s390/s390-modes.def: Add CCRAWmode. * config/s390/s390.h (processor_flags): Add PF_TX. (TARGET_CPU_HTM): Define macro. (TARGET_HTM): Define macro. (TARGET_CPU_CPP_BUILTINS): Define __HTM__ for htm. * config/s390/s390.md: Rename UNSPEC_CCU_TO_INT to UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. (UNSPECV_TBEGIN, UNSPECV_TBEGINC, UNSPECV_TEND, UNSPECV_TABORT) (UNSPECV_ETND, UNSPECV_NTSTG, UNSPECV_PPA): New unspecv enum values. (TBEGIN_MASK, TBEGINC_MASK): New constants. ("*cc_to_int"): Move up. ("*movcc", "*cjump_64", "*cjump_31"): Accept integer constants other than 0. ("*ccraw_to_int"): New insn and splitter definition. ("tbegin", "tbegin_nofloat", "tbegin_retry") ("tbegin_retry_nofloat", "tbeginc", "tend", "tabort") ("tx_assist"): New expander. ("tbegin_1", "tbegin_nofloat_1", "*tbeginc_1", "*tend_1") ("*tabort_1", "etnd", "ntstg", "*ppa"): New insn definition. * config/s390/s390.opt: Add -mhtm option. * config/s390/s390-protos.h (s390_emit_jump): Add return type. * config/s390/htmxlintrin.h: New file. * config/s390/htmintrin.h: New file. * config/s390/s390intrin.h: New file. * doc/extend.texi: Document htm builtins. * config.gcc: Add the new header files to extra_headers. 2013-07-17 Andreas Krebbel * config/s390/s390.c: (s390_expand_builtin): Allow -mhtm to be enabled without -march=zEC12. * config/s390/s390.h (TARGET_HTM): Do not require EC12 machine flags to be set. 2013-08-02 Andreas Krebbel Backports from mainline: 2013-04-23 Andreas Krebbel * config/s390/sjlj.S: New file. * config/s390/target.h: New file. * configure.tgt: Set options for S/390. 2013-06-27 Andreas Krebbel * config/s390/target.h: Include htmintrin.h. (_HTM_ITM_RETRIES): New macro definition. (htm_available, htm_init, htm_begin, htm_begin_success) (htm_commit, htm_abort, htm_abort_should_retry): New functions. 2013-07-17 Andreas Krebbel * acinclude.m4: Add htm asm check for s390. * configure.tgt: Add -mhtm and -Wa,-march=zEC12 to the options. * configure: Regenerate. * config/s390/target.h: Remove __HTM__ check. (htm_available): Call getauxval to get hwcaps and check whether HTM is available or not. 2013-07-29 Andreas Krebbel * config/s390/target.h (htm_begin, htm_commit, htm_abort) (htm_transaction_active): Enable zEC12 instructions in the assembler. * configure.tgt: Remove -Wa,-march=zEC12 from XCFLAGS. 2013-08-02 Andreas Krebbel * configure.tgt: Add -msoft-float to XCFLAGS. 2013-08-02 Andreas Krebbel Backport from mainline 2013-06-27 Andreas Krebbel * gcc.target/s390/htm-1.c: New file. * gcc.target/s390/htm-nofloat-1.c: New file. * gcc.target/s390/htm-xl-intrin-1.c: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201440 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 67 +++++ gcc/common/config/s390/s390-common.c | 2 +- gcc/config.gcc | 1 + gcc/config/s390/predicates.md | 12 +- gcc/config/s390/s390-modes.def | 9 + gcc/config/s390/s390-protos.h | 3 +- gcc/config/s390/s390.c | 560 ++++++++++++++++++++++++++++++++--- gcc/config/s390/s390.h | 36 ++- gcc/config/s390/s390.md | 281 ++++++++++++++++-- gcc/config/s390/s390.opt | 4 + gcc/doc/extend.texi | 115 +++++++ gcc/testsuite/ChangeLog | 9 + libitm/ChangeLog | 37 +++ libitm/acinclude.m4 | 11 + libitm/config.h.in | 9 + libitm/configure | 41 ++- libitm/configure.ac | 5 +- libitm/configure.tgt | 4 + 18 files changed, 1125 insertions(+), 81 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b2001cb5f73..33b097776c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,70 @@ +2013-08-02 Andreas Krebbel + + Backports from mainline: + 2013-06-27 Andreas Krebbel + + * config/s390/s390.c: Rename UNSPEC_CCU_TO_INT to + UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. + (struct machine_function): Add tbegin_p. + (s390_canonicalize_comparison): Fold CC mode compares to + conditional jump if possible. + (s390_emit_jump): Return the emitted jump. + (s390_branch_condition_mask, s390_branch_condition_mnemonic): + Handle CCRAWmode compares. + (s390_option_override): Default to -mhtm if available. + (s390_reg_clobbered_rtx): Handle floating point regs as well. + (s390_regs_ever_clobbered): Use s390_regs_ever_clobbered also for + FPRs instead of df_regs_ever_live_p. + (s390_optimize_nonescaping_tx): New function. + (s390_init_frame_layout): Extend clobbered_regs array to cover + FPRs as well. + (s390_emit_prologue): Call s390_optimize_nonescaping_tx. + (s390_expand_tbegin): New function. + (enum s390_builtin): New enum definition. + (code_for_builtin): New array definition. + (s390_init_builtins): New function. + (s390_expand_builtin): New function. + (TARGET_INIT_BUILTINS): Define. + (TARGET_EXPAND_BUILTIN): Define. + * common/config/s390/s390-common.c (processor_flags_table): Add + PF_TX. + * config/s390/predicates.md (s390_comparison): Handle CCRAWmode. + (s390_alc_comparison): Likewise. + * config/s390/s390-modes.def: Add CCRAWmode. + * config/s390/s390.h (processor_flags): Add PF_TX. + (TARGET_CPU_HTM): Define macro. + (TARGET_HTM): Define macro. + (TARGET_CPU_CPP_BUILTINS): Define __HTM__ for htm. + * config/s390/s390.md: Rename UNSPEC_CCU_TO_INT to + UNSPEC_STRCMPCC_TO_INT and UNSPEC_CCZ_TO_INT to UNSPEC_CC_TO_INT. + (UNSPECV_TBEGIN, UNSPECV_TBEGINC, UNSPECV_TEND, UNSPECV_TABORT) + (UNSPECV_ETND, UNSPECV_NTSTG, UNSPECV_PPA): New unspecv enum + values. + (TBEGIN_MASK, TBEGINC_MASK): New constants. + ("*cc_to_int"): Move up. + ("*movcc", "*cjump_64", "*cjump_31"): Accept integer + constants other than 0. + ("*ccraw_to_int"): New insn and splitter definition. + ("tbegin", "tbegin_nofloat", "tbegin_retry") + ("tbegin_retry_nofloat", "tbeginc", "tend", "tabort") + ("tx_assist"): New expander. + ("tbegin_1", "tbegin_nofloat_1", "*tbeginc_1", "*tend_1") + ("*tabort_1", "etnd", "ntstg", "*ppa"): New insn definition. + * config/s390/s390.opt: Add -mhtm option. + * config/s390/s390-protos.h (s390_emit_jump): Add return type. + * config/s390/htmxlintrin.h: New file. + * config/s390/htmintrin.h: New file. + * config/s390/s390intrin.h: New file. + * doc/extend.texi: Document htm builtins. + * config.gcc: Add the new header files to extra_headers. + + 2013-07-17 Andreas Krebbel + + * config/s390/s390.c: (s390_expand_builtin): Allow -mhtm to be + enabled without -march=zEC12. + * config/s390/s390.h (TARGET_HTM): Do not require EC12 machine + flags to be set. + 2013-08-01 Ganesh Gopalasubramanian Backport from mainline diff --git a/gcc/common/config/s390/s390-common.c b/gcc/common/config/s390/s390-common.c index 1ffe93e8a18..c2031b74b1f 100644 --- a/gcc/common/config/s390/s390-common.c +++ b/gcc/common/config/s390/s390-common.c @@ -42,7 +42,7 @@ EXPORTED_CONST int processor_flags_table[] = /* z196 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196, /* zEC12 */ PF_IEEE_FLOAT | PF_ZARCH | PF_LONG_DISPLACEMENT - | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 + | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 | PF_ZEC12 | PF_TX }; /* Change optimizations to be performed, depending on the diff --git a/gcc/config.gcc b/gcc/config.gcc index 1648dfeaba0..483e8e06942 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -452,6 +452,7 @@ s390*-*-*) cpu_type=s390 need_64bit_hwint=yes extra_options="${extra_options} fused-madd.opt" + extra_headers="s390intrin.h htmintrin.h htmxlintrin.h" ;; # Note the 'l'; we need to be able to match e.g. "shle" or "shl". sh[123456789lbe]*-*-* | sh-*-*) diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md index 523326e177d..069b42489a7 100644 --- a/gcc/config/s390/predicates.md +++ b/gcc/config/s390/predicates.md @@ -176,7 +176,11 @@ { if (GET_CODE (XEXP (op, 0)) != REG || REGNO (XEXP (op, 0)) != CC_REGNUM - || XEXP (op, 1) != const0_rtx) + || (XEXP (op, 1) != const0_rtx + && !(CONST_INT_P (XEXP (op, 1)) + && GET_MODE (XEXP (op, 0)) == CCRAWmode + && INTVAL (XEXP (op, 1)) >= 0 + && INTVAL (XEXP (op, 1)) <= 15))) return false; return (s390_branch_condition_mask (op) >= 0); @@ -224,7 +228,11 @@ if (GET_CODE (XEXP (op, 0)) != REG || REGNO (XEXP (op, 0)) != CC_REGNUM - || XEXP (op, 1) != const0_rtx) + || (XEXP (op, 1) != const0_rtx + && !(CONST_INT_P (XEXP (op, 1)) + && GET_MODE (XEXP (op, 0)) == CCRAWmode + && INTVAL (XEXP (op, 1)) >= 0 + && INTVAL (XEXP (op, 1)) <= 15))) return false; switch (GET_MODE (XEXP (op, 0))) diff --git a/gcc/config/s390/s390-modes.def b/gcc/config/s390/s390-modes.def index 419108fb473..5e0b50cafa1 100644 --- a/gcc/config/s390/s390-modes.def +++ b/gcc/config/s390/s390-modes.def @@ -152,6 +152,14 @@ The compare and swap instructions sets the condition code to 0/1 if the operands were equal/unequal. The CCZ1 mode ensures the result can be effectively placed into a register. +CCRAW + +The cc mode generated by a non-compare instruction. The condition +code mask for the CC consumer is determined by the comparison operator +(only EQ and NE allowed) and the immediate value given as second +operand to the operator. For the other CC modes this value used to be +0. + */ @@ -172,3 +180,4 @@ CC_MODE (CCT); CC_MODE (CCT1); CC_MODE (CCT2); CC_MODE (CCT3); +CC_MODE (CCRAW); diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 1a8205359e4..67283df4553 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -58,7 +58,7 @@ extern bool s390_match_ccmode (rtx, enum machine_mode); extern enum machine_mode s390_tm_ccmode (rtx, rtx, bool); extern enum machine_mode s390_select_ccmode (enum rtx_code, rtx, rtx); extern rtx s390_emit_compare (enum rtx_code, rtx, rtx); -extern void s390_emit_jump (rtx, rtx); +extern rtx s390_emit_jump (rtx, rtx); extern bool symbolic_reference_mentioned_p (rtx); extern bool tls_symbolic_reference_mentioned_p (rtx); extern bool legitimate_la_operand_p (rtx); @@ -87,6 +87,7 @@ extern void s390_expand_cs_hqi (enum machine_mode, rtx, rtx, rtx, rtx, rtx, bool); extern void s390_expand_atomic (enum machine_mode, enum rtx_code, rtx, rtx, rtx, bool); +extern void s390_expand_tbegin (rtx, rtx, rtx, bool); extern rtx s390_return_addr_rtx (int, rtx); extern rtx s390_back_chain_rtx (void); extern rtx s390_emit_call (rtx, rtx, rtx, rtx); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index ac33371937e..43db96c934b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -367,6 +367,10 @@ struct GTY(()) machine_function const char *some_ld_name; bool has_landing_pad_p; + + /* True if the current function may contain a tbegin clobbering + FPRs. */ + bool tbegin_p; }; /* Few accessor macros for struct cfun->machine->s390_frame_layout. */ @@ -824,9 +828,9 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1, *op1 = constm1_rtx; } - /* Remove redundant UNSPEC_CCU_TO_INT conversions if possible. */ + /* Remove redundant UNSPEC_STRCMPCC_TO_INT conversions if possible. */ if (GET_CODE (*op0) == UNSPEC - && XINT (*op0, 1) == UNSPEC_CCU_TO_INT + && XINT (*op0, 1) == UNSPEC_STRCMPCC_TO_INT && XVECLEN (*op0, 0) == 1 && GET_MODE (XVECEXP (*op0, 0, 0)) == CCUmode && GET_CODE (XVECEXP (*op0, 0, 0)) == REG @@ -852,25 +856,35 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1, } } - /* Remove redundant UNSPEC_CCZ_TO_INT conversions if possible. */ + /* Remove redundant UNSPEC_CC_TO_INT conversions if possible. */ if (GET_CODE (*op0) == UNSPEC - && XINT (*op0, 1) == UNSPEC_CCZ_TO_INT + && XINT (*op0, 1) == UNSPEC_CC_TO_INT && XVECLEN (*op0, 0) == 1 - && GET_MODE (XVECEXP (*op0, 0, 0)) == CCZmode && GET_CODE (XVECEXP (*op0, 0, 0)) == REG && REGNO (XVECEXP (*op0, 0, 0)) == CC_REGNUM - && *op1 == const0_rtx) + && CONST_INT_P (*op1)) { enum rtx_code new_code = UNKNOWN; - switch (*code) + switch (GET_MODE (XVECEXP (*op0, 0, 0))) { - case EQ: new_code = EQ; break; - case NE: new_code = NE; break; - default: break; + case CCZmode: + case CCRAWmode: + switch (*code) + { + case EQ: new_code = EQ; break; + case NE: new_code = NE; break; + default: break; + } + break; + default: break; } if (new_code != UNKNOWN) { + /* For CCRAWmode put the required cc mask into the second + operand. */ + if (GET_MODE (XVECEXP (*op0, 0, 0)) == CCRAWmode) + *op1 = gen_rtx_CONST_INT (VOIDmode, 1 << (3 - INTVAL (*op1))); *op0 = XVECEXP (*op0, 0, 0); *code = new_code; } @@ -942,10 +956,11 @@ s390_emit_compare_and_swap (enum rtx_code code, rtx old, rtx mem, const0_rtx); } -/* Emit a jump instruction to TARGET. If COND is NULL_RTX, emit an - unconditional jump, else a conditional jump under condition COND. */ +/* Emit a jump instruction to TARGET and return it. If COND is + NULL_RTX, emit an unconditional jump, else a conditional jump under + condition COND. */ -void +rtx s390_emit_jump (rtx target, rtx cond) { rtx insn; @@ -955,7 +970,7 @@ s390_emit_jump (rtx target, rtx cond) target = gen_rtx_IF_THEN_ELSE (VOIDmode, cond, target, pc_rtx); insn = gen_rtx_SET (VOIDmode, pc_rtx, target); - emit_jump_insn (insn); + return emit_jump_insn (insn); } /* Return branch condition mask to implement a branch @@ -971,7 +986,10 @@ s390_branch_condition_mask (rtx code) gcc_assert (GET_CODE (XEXP (code, 0)) == REG); gcc_assert (REGNO (XEXP (code, 0)) == CC_REGNUM); - gcc_assert (XEXP (code, 1) == const0_rtx); + gcc_assert (XEXP (code, 1) == const0_rtx + || (GET_MODE (XEXP (code, 0)) == CCRAWmode + && CONST_INT_P (XEXP (code, 1)))); + switch (GET_MODE (XEXP (code, 0))) { @@ -1145,6 +1163,17 @@ s390_branch_condition_mask (rtx code) } break; + case CCRAWmode: + switch (GET_CODE (code)) + { + case EQ: + return INTVAL (XEXP (code, 1)); + case NE: + return (INTVAL (XEXP (code, 1))) ^ 0xf; + default: + gcc_unreachable (); + } + default: return -1; } @@ -1204,7 +1233,9 @@ s390_branch_condition_mnemonic (rtx code, int inv) if (GET_CODE (XEXP (code, 0)) == REG && REGNO (XEXP (code, 0)) == CC_REGNUM - && XEXP (code, 1) == const0_rtx) + && (XEXP (code, 1) == const0_rtx + || (GET_MODE (XEXP (code, 0)) == CCRAWmode + && CONST_INT_P (XEXP (code, 1))))) mask = s390_branch_condition_mask (code); else mask = s390_compare_and_branch_condition_mask (code); @@ -1602,6 +1633,11 @@ s390_option_override (void) if (!(target_flags_explicit & MASK_HARD_DFP) && TARGET_DFP) target_flags |= MASK_HARD_DFP; + /* Enable hardware transactions if available and not explicitly + disabled by user. E.g. with -m31 -march=zEC12 -mzarch */ + if (!(target_flags_explicit & MASK_OPT_HTM) && TARGET_CPU_HTM && TARGET_ZARCH) + target_flags |= MASK_OPT_HTM; + if (TARGET_HARD_DFP && !TARGET_DFP) { if (target_flags_explicit & MASK_HARD_DFP) @@ -7341,11 +7377,11 @@ s390_reg_clobbered_rtx (rtx setreg, const_rtx set_insn ATTRIBUTE_UNUSED, void *d if (GET_CODE (setreg) == SUBREG) { rtx inner = SUBREG_REG (setreg); - if (!GENERAL_REG_P (inner)) + if (!GENERAL_REG_P (inner) && !FP_REG_P (inner)) return; regno = subreg_regno (setreg); } - else if (GENERAL_REG_P (setreg)) + else if (GENERAL_REG_P (setreg) || FP_REG_P (setreg)) regno = REGNO (setreg); else return; @@ -7368,13 +7404,13 @@ s390_regs_ever_clobbered (int *regs_ever_clobbered) rtx cur_insn; unsigned int i; - memset (regs_ever_clobbered, 0, 16 * sizeof (int)); + memset (regs_ever_clobbered, 0, 32 * sizeof (int)); /* For non-leaf functions we have to consider all call clobbered regs to be clobbered. */ if (!crtl->is_leaf) { - for (i = 0; i < 16; i++) + for (i = 0; i < 32; i++) regs_ever_clobbered[i] = call_really_used_regs[i]; } @@ -7396,7 +7432,7 @@ s390_regs_ever_clobbered (int *regs_ever_clobbered) See expand_builtin_unwind_init. For regs_ever_live this is done by reload. */ if (cfun->has_nonlocal_label) - for (i = 0; i < 16; i++) + for (i = 0; i < 32; i++) if (!call_really_used_regs[i]) regs_ever_clobbered[i] = 1; @@ -7462,17 +7498,6 @@ s390_register_info (int clobbered_regs[]) { int i, j; - /* fprs 8 - 15 are call saved for 64 Bit ABI. */ - cfun_frame_layout.fpr_bitmap = 0; - cfun_frame_layout.high_fprs = 0; - if (TARGET_64BIT) - for (i = 24; i < 32; i++) - if (df_regs_ever_live_p (i) && !global_regs[i]) - { - cfun_set_fpr_bit (i - 16); - cfun_frame_layout.high_fprs++; - } - /* Find first and last gpr to be saved. We trust regs_ever_live data, except that we don't save and restore global registers. @@ -7481,6 +7506,28 @@ s390_register_info (int clobbered_regs[]) s390_regs_ever_clobbered (clobbered_regs); + /* fprs 8 - 15 are call saved for 64 Bit ABI. */ + if (!epilogue_completed) + { + cfun_frame_layout.fpr_bitmap = 0; + cfun_frame_layout.high_fprs = 0; + if (TARGET_64BIT) + for (i = 24; i < 32; i++) + /* During reload we have to use the df_regs_ever_live infos + since reload is marking FPRs used as spill slots there as + live before actually making the code changes. Without + this we fail during elimination offset verification. */ + if ((clobbered_regs[i] + || (df_regs_ever_live_p (i) + && (reload_in_progress + || crtl->saves_all_registers))) + && !global_regs[i]) + { + cfun_set_fpr_bit (i - 16); + cfun_frame_layout.high_fprs++; + } + } + for (i = 0; i < 16; i++) clobbered_regs[i] = clobbered_regs[i] && !global_regs[i] && !fixed_regs[i]; @@ -7731,7 +7778,7 @@ s390_init_frame_layout (void) { HOST_WIDE_INT frame_size; int base_used; - int clobbered_regs[16]; + int clobbered_regs[32]; /* On S/390 machines, we may need to perform branch splitting, which will require both base and return address register. We have no @@ -7766,6 +7813,157 @@ s390_init_frame_layout (void) while (frame_size != cfun_frame_layout.frame_size); } +/* Remove the FPR clobbers from a tbegin insn if it can be proven that + the TX is nonescaping. A transaction is considered escaping if + there is at least one path from tbegin returning CC0 to the + function exit block without an tend. + + The check so far has some limitations: + - only single tbegin/tend BBs are supported + - the first cond jump after tbegin must separate the CC0 path from ~CC0 + - when CC is copied to a GPR and the CC0 check is done with the GPR + this is not supported +*/ + +static void +s390_optimize_nonescaping_tx (void) +{ + const unsigned int CC0 = 1 << 3; + basic_block tbegin_bb = NULL; + basic_block tend_bb = NULL; + basic_block bb; + rtx insn; + bool result = true; + int bb_index; + rtx tbegin_insn = NULL_RTX; + + if (!cfun->machine->tbegin_p) + return; + + for (bb_index = 0; bb_index < n_basic_blocks; bb_index++) + { + bb = BASIC_BLOCK (bb_index); + + FOR_BB_INSNS (bb, insn) + { + rtx ite, cc, pat, target; + unsigned HOST_WIDE_INT mask; + + if (!INSN_P (insn) || INSN_CODE (insn) <= 0) + continue; + + pat = PATTERN (insn); + + if (GET_CODE (pat) == PARALLEL) + pat = XVECEXP (pat, 0, 0); + + if (GET_CODE (pat) != SET + || GET_CODE (SET_SRC (pat)) != UNSPEC_VOLATILE) + continue; + + if (XINT (SET_SRC (pat), 1) == UNSPECV_TBEGIN) + { + rtx tmp; + + tbegin_insn = insn; + + /* Just return if the tbegin doesn't have clobbers. */ + if (GET_CODE (PATTERN (insn)) != PARALLEL) + return; + + if (tbegin_bb != NULL) + return; + + /* Find the next conditional jump. */ + for (tmp = NEXT_INSN (insn); + tmp != NULL_RTX; + tmp = NEXT_INSN (tmp)) + { + if (reg_set_p (gen_rtx_REG (CCmode, CC_REGNUM), tmp)) + return; + if (!JUMP_P (tmp)) + continue; + + ite = SET_SRC (PATTERN (tmp)); + if (GET_CODE (ite) != IF_THEN_ELSE) + continue; + + cc = XEXP (XEXP (ite, 0), 0); + if (!REG_P (cc) || !CC_REGNO_P (REGNO (cc)) + || GET_MODE (cc) != CCRAWmode + || GET_CODE (XEXP (XEXP (ite, 0), 1)) != CONST_INT) + return; + + if (bb->succs->length () != 2) + return; + + mask = INTVAL (XEXP (XEXP (ite, 0), 1)); + if (GET_CODE (XEXP (ite, 0)) == NE) + mask ^= 0xf; + + if (mask == CC0) + target = XEXP (ite, 1); + else if (mask == (CC0 ^ 0xf)) + target = XEXP (ite, 2); + else + return; + + { + edge_iterator ei; + edge e1, e2; + + ei = ei_start (bb->succs); + e1 = ei_safe_edge (ei); + ei_next (&ei); + e2 = ei_safe_edge (ei); + + if (e2->flags & EDGE_FALLTHRU) + { + e2 = e1; + e1 = ei_safe_edge (ei); + } + + if (!(e1->flags & EDGE_FALLTHRU)) + return; + + tbegin_bb = (target == pc_rtx) ? e1->dest : e2->dest; + } + if (tmp == BB_END (bb)) + break; + } + } + + if (XINT (SET_SRC (pat), 1) == UNSPECV_TEND) + { + if (tend_bb != NULL) + return; + tend_bb = bb; + } + } + } + + /* Either we successfully remove the FPR clobbers here or we are not + able to do anything for this TX. Both cases don't qualify for + another look. */ + cfun->machine->tbegin_p = false; + + if (tbegin_bb == NULL || tend_bb == NULL) + return; + + calculate_dominance_info (CDI_POST_DOMINATORS); + result = dominated_by_p (CDI_POST_DOMINATORS, tbegin_bb, tend_bb); + free_dominance_info (CDI_POST_DOMINATORS); + + if (!result) + return; + + PATTERN (tbegin_insn) = XVECEXP (PATTERN (tbegin_insn), 0, 0); + INSN_CODE (tbegin_insn) = -1; + df_insn_rescan (tbegin_insn); + + return; +} + /* Update frame layout. Recompute actual register save data based on current info and update regs_ever_live for the special registers. May be called multiple times, but may never cause *more* registers @@ -7774,7 +7972,7 @@ s390_init_frame_layout (void) static void s390_update_frame_layout (void) { - int clobbered_regs[16]; + int clobbered_regs[32]; s390_register_info (clobbered_regs); @@ -8204,8 +8402,10 @@ s390_emit_prologue (void) int offset; int next_fpr = 0; - /* Complete frame layout. */ + /* Try to get rid of the FPR clobbers. */ + s390_optimize_nonescaping_tx (); + /* Complete frame layout. */ s390_update_frame_layout (); /* Annotate all constant pool references to let the scheduler know @@ -9353,6 +9553,291 @@ s390_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p, return build_va_arg_indirect_ref (addr); } +/* Emit rtl for the tbegin or tbegin_retry (RETRY != NULL_RTX) + expanders. + DEST - Register location where CC will be stored. + TDB - Pointer to a 256 byte area where to store the transaction. + diagnostic block. NULL if TDB is not needed. + RETRY - Retry count value. If non-NULL a retry loop for CC2 + is emitted + CLOBBER_FPRS_P - If true clobbers for all FPRs are emitted as part + of the tbegin instruction pattern. */ + +void +s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p) +{ + const int CC0 = 1 << 3; + const int CC1 = 1 << 2; + const int CC3 = 1 << 0; + rtx abort_label = gen_label_rtx (); + rtx leave_label = gen_label_rtx (); + rtx retry_reg = gen_reg_rtx (SImode); + rtx retry_label = NULL_RTX; + rtx jump; + rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1); + + if (retry != NULL_RTX) + { + emit_move_insn (retry_reg, retry); + retry_label = gen_label_rtx (); + emit_label (retry_label); + } + + if (clobber_fprs_p) + emit_insn (gen_tbegin_1 (tdb, + gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK))); + else + emit_insn (gen_tbegin_nofloat_1 (tdb, + gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK))); + + jump = s390_emit_jump (abort_label, + gen_rtx_NE (VOIDmode, + gen_rtx_REG (CCRAWmode, CC_REGNUM), + gen_rtx_CONST_INT (VOIDmode, CC0))); + + JUMP_LABEL (jump) = abort_label; + LABEL_NUSES (abort_label) = 1; + add_reg_note (jump, REG_BR_PROB, very_unlikely); + + /* Initialize CC return value. */ + emit_move_insn (dest, const0_rtx); + + s390_emit_jump (leave_label, NULL_RTX); + LABEL_NUSES (leave_label) = 1; + emit_barrier (); + + /* Abort handler code. */ + + emit_label (abort_label); + if (retry != NULL_RTX) + { + rtx count = gen_reg_rtx (SImode); + jump = s390_emit_jump (leave_label, + gen_rtx_EQ (VOIDmode, + gen_rtx_REG (CCRAWmode, CC_REGNUM), + gen_rtx_CONST_INT (VOIDmode, CC1 | CC3))); + LABEL_NUSES (leave_label) = 2; + add_reg_note (jump, REG_BR_PROB, very_unlikely); + + /* CC2 - transient failure. Perform retry with ppa. */ + emit_move_insn (count, retry); + emit_insn (gen_subsi3 (count, count, retry_reg)); + emit_insn (gen_tx_assist (count)); + jump = emit_jump_insn (gen_doloop_si64 (retry_label, + retry_reg, + retry_reg)); + JUMP_LABEL (jump) = retry_label; + LABEL_NUSES (retry_label) = 1; + } + + emit_move_insn (dest, gen_rtx_UNSPEC (SImode, + gen_rtvec (1, gen_rtx_REG (CCRAWmode, + CC_REGNUM)), + UNSPEC_CC_TO_INT)); + emit_label (leave_label); +} + +/* Builtins. */ + +enum s390_builtin +{ + S390_BUILTIN_TBEGIN, + S390_BUILTIN_TBEGIN_NOFLOAT, + S390_BUILTIN_TBEGIN_RETRY, + S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, + S390_BUILTIN_TBEGINC, + S390_BUILTIN_TEND, + S390_BUILTIN_TABORT, + S390_BUILTIN_NON_TX_STORE, + S390_BUILTIN_TX_NESTING_DEPTH, + S390_BUILTIN_TX_ASSIST, + + S390_BUILTIN_max +}; + +static enum insn_code const code_for_builtin[S390_BUILTIN_max] = { + CODE_FOR_tbegin, + CODE_FOR_tbegin_nofloat, + CODE_FOR_tbegin_retry, + CODE_FOR_tbegin_retry_nofloat, + CODE_FOR_tbeginc, + CODE_FOR_tend, + CODE_FOR_tabort, + CODE_FOR_ntstg, + CODE_FOR_etnd, + CODE_FOR_tx_assist +}; + +static void +s390_init_builtins (void) +{ + tree ftype, uint64_type; + + /* void foo (void) */ + ftype = build_function_type_list (void_type_node, NULL_TREE); + add_builtin_function ("__builtin_tbeginc", ftype, S390_BUILTIN_TBEGINC, + BUILT_IN_MD, NULL, NULL_TREE); + + /* void foo (int) */ + ftype = build_function_type_list (void_type_node, integer_type_node, + NULL_TREE); + add_builtin_function ("__builtin_tabort", ftype, + S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, NULL_TREE); + add_builtin_function ("__builtin_tx_assist", ftype, + S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); + + /* int foo (void *) */ + ftype = build_function_type_list (integer_type_node, ptr_type_node, NULL_TREE); + add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN, + BUILT_IN_MD, NULL, NULL_TREE); + add_builtin_function ("__builtin_tbegin_nofloat", ftype, + S390_BUILTIN_TBEGIN_NOFLOAT, + BUILT_IN_MD, NULL, NULL_TREE); + + /* int foo (void *, int) */ + ftype = build_function_type_list (integer_type_node, ptr_type_node, + integer_type_node, NULL_TREE); + add_builtin_function ("__builtin_tbegin_retry", ftype, + S390_BUILTIN_TBEGIN_RETRY, + BUILT_IN_MD, + NULL, NULL_TREE); + add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype, + S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, + BUILT_IN_MD, + NULL, NULL_TREE); + + /* int foo (void) */ + ftype = build_function_type_list (integer_type_node, NULL_TREE); + add_builtin_function ("__builtin_tx_nesting_depth", ftype, + S390_BUILTIN_TX_NESTING_DEPTH, + BUILT_IN_MD, NULL, NULL_TREE); + add_builtin_function ("__builtin_tend", ftype, + S390_BUILTIN_TEND, BUILT_IN_MD, NULL, NULL_TREE); + + /* void foo (uint64_t *, uint64_t) */ + if (TARGET_64BIT) + uint64_type = long_unsigned_type_node; + else + uint64_type = long_long_unsigned_type_node; + + ftype = build_function_type_list (void_type_node, + build_pointer_type (uint64_type), + uint64_type, NULL_TREE); + add_builtin_function ("__builtin_non_tx_store", ftype, + S390_BUILTIN_NON_TX_STORE, + BUILT_IN_MD, NULL, NULL_TREE); +} + +/* Expand an expression EXP that calls a built-in function, + with result going to TARGET if that's convenient + (and in mode MODE if that's convenient). + SUBTARGET may be used as the target for computing one of EXP's operands. + IGNORE is nonzero if the value is to be ignored. */ + +static rtx +s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + int ignore ATTRIBUTE_UNUSED) +{ +#define MAX_ARGS 2 + + tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); + unsigned int fcode = DECL_FUNCTION_CODE (fndecl); + enum insn_code icode; + rtx op[MAX_ARGS], pat; + int arity; + bool nonvoid; + tree arg; + call_expr_arg_iterator iter; + + if (fcode >= S390_BUILTIN_max) + internal_error ("bad builtin fcode"); + icode = code_for_builtin[fcode]; + if (icode == 0) + internal_error ("bad builtin fcode"); + + if (!TARGET_HTM) + error ("Transactional execution builtins not enabled (-mhtm)\n"); + + /* Set a flag in the machine specific cfun part in order to support + saving/restoring of FPRs. */ + if (fcode == S390_BUILTIN_TBEGIN || fcode == S390_BUILTIN_TBEGIN_RETRY) + cfun->machine->tbegin_p = true; + + nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node; + + arity = 0; + FOR_EACH_CALL_EXPR_ARG (arg, iter, exp) + { + const struct insn_operand_data *insn_op; + + if (arg == error_mark_node) + return NULL_RTX; + if (arity >= MAX_ARGS) + return NULL_RTX; + + insn_op = &insn_data[icode].operand[arity + nonvoid]; + + op[arity] = expand_expr (arg, NULL_RTX, insn_op->mode, EXPAND_NORMAL); + + if (!(*insn_op->predicate) (op[arity], insn_op->mode)) + { + if (insn_op->predicate == memory_operand) + { + /* Don't move a NULL pointer into a register. Otherwise + we have to rely on combine being able to move it back + in order to get an immediate 0 in the instruction. */ + if (op[arity] != const0_rtx) + op[arity] = copy_to_mode_reg (Pmode, op[arity]); + op[arity] = gen_rtx_MEM (insn_op->mode, op[arity]); + } + else + op[arity] = copy_to_mode_reg (insn_op->mode, op[arity]); + } + + arity++; + } + + if (nonvoid) + { + enum machine_mode tmode = insn_data[icode].operand[0].mode; + if (!target + || GET_MODE (target) != tmode + || !(*insn_data[icode].operand[0].predicate) (target, tmode)) + target = gen_reg_rtx (tmode); + } + + switch (arity) + { + case 0: + pat = GEN_FCN (icode) (target); + break; + case 1: + if (nonvoid) + pat = GEN_FCN (icode) (target, op[0]); + else + pat = GEN_FCN (icode) (op[0]); + break; + case 2: + if (nonvoid) + pat = GEN_FCN (icode) (target, op[0], op[1]); + else + pat = GEN_FCN (icode) (op[0], op[1]); + break; + default: + gcc_unreachable (); + } + if (!pat) + return NULL_RTX; + emit_insn (pat); + + if (nonvoid) + return target; + else + return const0_rtx; +} + + /* Output assembly code for the trampoline template to stdio stream FILE. @@ -11008,6 +11493,11 @@ s390_loop_unroll_adjust (unsigned nunroll, struct loop *loop) #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY s390_return_in_memory +#undef TARGET_INIT_BUILTINS +#define TARGET_INIT_BUILTINS s390_init_builtins +#undef TARGET_EXPAND_BUILTIN +#define TARGET_EXPAND_BUILTIN s390_expand_builtin + #undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA #define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA s390_output_addr_const_extra diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 43e24d5d112..03ab89000a8 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -34,7 +34,8 @@ enum processor_flags PF_DFP = 16, PF_Z10 = 32, PF_Z196 = 64, - PF_ZEC12 = 128 + PF_ZEC12 = 128, + PF_TX = 256 }; /* This is necessary to avoid a warning about comparing different enum @@ -61,6 +62,8 @@ enum processor_flags (s390_arch_flags & PF_Z196) #define TARGET_CPU_ZEC12 \ (s390_arch_flags & PF_ZEC12) +#define TARGET_CPU_HTM \ + (s390_arch_flags & PF_TX) /* These flags indicate that the generated code should run on a cpu providing the respective hardware facility when run in @@ -78,6 +81,7 @@ enum processor_flags (TARGET_ZARCH && TARGET_CPU_Z196) #define TARGET_ZEC12 \ (TARGET_ZARCH && TARGET_CPU_ZEC12) +#define TARGET_HTM (TARGET_OPT_HTM) #define TARGET_AVOID_CMP_AND_BRANCH (s390_tune == PROCESSOR_2817_Z196) @@ -93,23 +97,25 @@ enum processor_flags #define TARGET_TPF 0 /* Target CPU builtins. */ -#define TARGET_CPU_CPP_BUILTINS() \ - do \ - { \ - builtin_assert ("cpu=s390"); \ - builtin_assert ("machine=s390"); \ - builtin_define ("__s390__"); \ - if (TARGET_ZARCH) \ - builtin_define ("__zarch__"); \ - if (TARGET_64BIT) \ - builtin_define ("__s390x__"); \ - if (TARGET_LONG_DOUBLE_128) \ - builtin_define ("__LONG_DOUBLE_128__"); \ - } \ +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_assert ("cpu=s390"); \ + builtin_assert ("machine=s390"); \ + builtin_define ("__s390__"); \ + if (TARGET_ZARCH) \ + builtin_define ("__zarch__"); \ + if (TARGET_64BIT) \ + builtin_define ("__s390x__"); \ + if (TARGET_LONG_DOUBLE_128) \ + builtin_define ("__LONG_DOUBLE_128__"); \ + if (TARGET_HTM) \ + builtin_define ("__HTM__"); \ + } \ while (0) #ifdef DEFAULT_TARGET_64BIT -#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP) +#define TARGET_DEFAULT (MASK_64BIT | MASK_ZARCH | MASK_HARD_DFP | MASK_OPT_HTM) #else #define TARGET_DEFAULT 0 #endif diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index d68613960ba..da9d449530d 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -59,11 +59,17 @@ (define_c_enum "unspec" [ ; Miscellaneous UNSPEC_ROUND - UNSPEC_CCU_TO_INT - UNSPEC_CCZ_TO_INT UNSPEC_ICM UNSPEC_TIE + ; Convert CC into a str comparison result and copy it into an + ; integer register + ; cc0->0, cc1->1, cc2->-1, (cc3->-1) + UNSPEC_STRCMPCC_TO_INT + + ; Copy CC as is into the lower 2 bits of an integer register + UNSPEC_CC_TO_INT + ; GOT/PLT and lt-relative accesses UNSPEC_LTREL_OFFSET UNSPEC_LTREL_BASE @@ -138,6 +144,15 @@ ; Atomic Support UNSPECV_CAS UNSPECV_ATOMIC_OP + + ; Transactional Execution support + UNSPECV_TBEGIN + UNSPECV_TBEGINC + UNSPECV_TEND + UNSPECV_TABORT + UNSPECV_ETND + UNSPECV_NTSTG + UNSPECV_PPA ]) ;; @@ -191,6 +206,9 @@ (PFPO_OP1_TYPE_SHIFT 8) ]) +; Immediate operands for tbegin and tbeginc +(define_constants [(TBEGIN_MASK 65292)]) ; 0xff0c +(define_constants [(TBEGINC_MASK 65288)]) ; 0xff08 ;; Instruction operand type as used in the Principles of Operation. ;; Used to determine defaults for length and other attribute values. @@ -2246,7 +2264,7 @@ (define_insn "movcc" [(set (match_operand:CC 0 "nonimmediate_operand" "=d,c,d,d,d,R,T") - (match_operand:CC 1 "nonimmediate_operand" "d,d,c,R,T,d,d"))] + (match_operand:CC 1 "nonimmediate_operand" " d,d,c,R,T,d,d"))] "" "@ lr\t%0,%1 @@ -2578,7 +2596,7 @@ (use (reg:SI 0))]) (parallel [(set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_CCU_TO_INT)) + (unspec:SI [(reg:CCU CC_REGNUM)] UNSPEC_STRCMPCC_TO_INT)) (clobber (reg:CC CC_REGNUM))])] "" { @@ -2820,7 +2838,7 @@ (match_dup 2)] UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))] + (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] "TARGET_HARD_FLOAT" { operands[2] = GEN_INT (S390_TDC_SIGNBIT_SET); @@ -2832,12 +2850,21 @@ (match_dup 2)] UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))] + (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CC_TO_INT))] "TARGET_HARD_FLOAT" { operands[2] = GEN_INT (S390_TDC_INFINITY); }) +(define_insn_and_split "*cc_to_int" + [(set (match_operand:SI 0 "register_operand" "=d") + (unspec:SI [(match_operand 1 "register_operand" "0")] + UNSPEC_CC_TO_INT))] + "operands != NULL" + "#" + "reload_completed" + [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))]) + ; This insn is used to generate all variants of the Test Data Class ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand ; is the register to be tested and the second one is the bit mask @@ -2853,14 +2880,6 @@ [(set_attr "op_type" "RXE") (set_attr "type" "fsimp")]) -(define_insn_and_split "*ccz_to_int" - [(set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(match_operand:CCZ 1 "register_operand" "0")] - UNSPEC_CCZ_TO_INT))] - "" - "#" - "reload_completed" - [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (const_int 28)))]) ; @@ -3205,7 +3224,7 @@ (define_insn_and_split "cmpint" [(set (match_operand:SI 0 "register_operand" "=d") (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] - UNSPEC_CCU_TO_INT)) + UNSPEC_STRCMPCC_TO_INT)) (clobber (reg:CC CC_REGNUM))] "" "#" @@ -3218,10 +3237,10 @@ (define_insn_and_split "*cmpint_cc" [(set (reg CC_REGNUM) (compare (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] - UNSPEC_CCU_TO_INT) + UNSPEC_STRCMPCC_TO_INT) (const_int 0))) (set (match_operand:SI 0 "register_operand" "=d") - (unspec:SI [(match_dup 1)] UNSPEC_CCU_TO_INT))] + (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT))] "s390_match_ccmode (insn, CCSmode)" "#" "&& reload_completed" @@ -3238,7 +3257,7 @@ (define_insn_and_split "*cmpint_sign" [(set (match_operand:DI 0 "register_operand" "=d") (sign_extend:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] - UNSPEC_CCU_TO_INT))) + UNSPEC_STRCMPCC_TO_INT))) (clobber (reg:CC CC_REGNUM))] "TARGET_ZARCH" "#" @@ -3252,11 +3271,11 @@ [(set (reg CC_REGNUM) (compare (ashiftrt:DI (ashift:DI (subreg:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] - UNSPEC_CCU_TO_INT) 0) + UNSPEC_STRCMPCC_TO_INT) 0) (const_int 32)) (const_int 32)) (const_int 0))) (set (match_operand:DI 0 "register_operand" "=d") - (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_CCU_TO_INT)))] + (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_STRCMPCC_TO_INT)))] "s390_match_ccmode (insn, CCSmode) && TARGET_ZARCH" "#" "&& reload_completed" @@ -5507,7 +5526,7 @@ (if_then_else:GPR (match_operator 1 "s390_comparison" [(match_operand 2 "cc_reg_operand" " c,c, c, c, c, c, c") - (const_int 0)]) + (match_operand 5 "const_int_operand" "")]) (match_operand:GPR 3 "nonimmediate_operand" " d,0,QS, 0, d, 0,QS") (match_operand:GPR 4 "nonimmediate_operand" " 0,d, 0,QS, 0, d,QS")))] "TARGET_Z196" @@ -7907,7 +7926,8 @@ (define_insn "*cjump_64" [(set (pc) (if_then_else - (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) + (match_operator 1 "s390_comparison" [(reg CC_REGNUM) + (match_operand 2 "const_int_operand" "")]) (label_ref (match_operand 0 "" "")) (pc)))] "TARGET_CPU_ZARCH" @@ -7926,7 +7946,8 @@ (define_insn "*cjump_31" [(set (pc) (if_then_else - (match_operator 1 "s390_comparison" [(reg CC_REGNUM) (const_int 0)]) + (match_operator 1 "s390_comparison" [(reg CC_REGNUM) + (match_operand 2 "const_int_operand" "")]) (label_ref (match_operand 0 "" "")) (pc)))] "!TARGET_CPU_ZARCH" @@ -9795,3 +9816,217 @@ "cpsdr\t%0,%2,%1" [(set_attr "op_type" "RRF") (set_attr "type" "fsimp")]) + + +;; +;;- Transactional execution instructions +;; + +; This splitter helps combine to make use of CC directly when +; comparing the integer result of a tbegin builtin with a constant. +; The unspec is already removed by canonicalize_comparison. So this +; splitters only job is to turn the PARALLEL into separate insns +; again. Unfortunately this only works with the very first cc/int +; compare since combine is not able to deal with data flow across +; basic block boundaries. + +; It needs to be an insn pattern as well since combine does not apply +; the splitter directly. Combine would only use it if it actually +; would reduce the number of instructions. +(define_insn_and_split "*ccraw_to_int" + [(set (pc) + (if_then_else + (match_operator 0 "s390_eqne_operator" + [(reg:CCRAW CC_REGNUM) + (match_operand 1 "const_int_operand" "")]) + (label_ref (match_operand 2 "" "")) + (pc))) + (set (match_operand:SI 3 "register_operand" "=d") + (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] + "" + "#" + "" + [(set (match_dup 3) + (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT)) + (set (pc) + (if_then_else (match_op_dup 0 [(reg:CCRAW CC_REGNUM) (match_dup 1)]) + (label_ref (match_dup 2)) + (pc)))] + "") + +; Non-constrained transaction begin + +(define_expand "tbegin" + [(match_operand:SI 0 "register_operand" "=d") + (match_operand:BLK 1 "memory_operand" "=Q")] + "TARGET_HTM" +{ + s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true); + DONE; +}) + +(define_expand "tbegin_nofloat" + [(match_operand:SI 0 "register_operand" "=d") + (match_operand:BLK 1 "memory_operand" "=Q")] + "TARGET_HTM" +{ + s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false); + DONE; +}) + +(define_expand "tbegin_retry" + [(match_operand:SI 0 "register_operand" "=d") + (match_operand:BLK 1 "memory_operand" "=Q") + (match_operand 2 "const_int_operand")] + "TARGET_HTM" +{ + s390_expand_tbegin (operands[0], operands[1], operands[2], true); + DONE; +}) + +(define_expand "tbegin_retry_nofloat" + [(match_operand:SI 0 "register_operand" "=d") + (match_operand:BLK 1 "memory_operand" "=Q") + (match_operand 2 "const_int_operand")] + "TARGET_HTM" +{ + s390_expand_tbegin (operands[0], operands[1], operands[2], false); + DONE; +}) + +(define_insn "tbegin_1" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(match_operand:BLK 0 "memory_operand" "=Q") + (match_operand 1 "const_int_operand" " D")] + UNSPECV_TBEGIN)) + (clobber (reg:DF 16)) + (clobber (reg:DF 17)) + (clobber (reg:DF 18)) + (clobber (reg:DF 19)) + (clobber (reg:DF 20)) + (clobber (reg:DF 21)) + (clobber (reg:DF 22)) + (clobber (reg:DF 23)) + (clobber (reg:DF 24)) + (clobber (reg:DF 25)) + (clobber (reg:DF 26)) + (clobber (reg:DF 27)) + (clobber (reg:DF 28)) + (clobber (reg:DF 29)) + (clobber (reg:DF 30)) + (clobber (reg:DF 31))] +; CONST_OK_FOR_CONSTRAINT_P does not work with D constraint since D is +; not supposed to be used for immediates (see genpreds.c). + "TARGET_HTM && INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 0xffff" + "tbegin\t%0,%x1" + [(set_attr "op_type" "SIL")]) + +; Same as above but without the FPR clobbers +(define_insn "tbegin_nofloat_1" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(match_operand:BLK 0 "memory_operand" "=Q") + (match_operand 1 "const_int_operand" " D")] + UNSPECV_TBEGIN))] + "TARGET_HTM && INTVAL (operands[1]) >= 0 && INTVAL (operands[1]) <= 0xffff" + "tbegin\t%0,%x1" + [(set_attr "op_type" "SIL")]) + + +; Constrained transaction begin + +(define_expand "tbeginc" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(const_int TBEGINC_MASK)] + UNSPECV_TBEGINC))] + "TARGET_HTM" + "") + +(define_insn "*tbeginc_1" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" " D")] + UNSPECV_TBEGINC))] + "TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff" + "tbeginc\t0,%x0" + [(set_attr "op_type" "SIL")]) + +; Transaction end + +(define_expand "tend" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND)) + (set (match_operand:SI 0 "register_operand" "=d") + (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] + "TARGET_HTM" + "") + +(define_insn "*tend_1" + [(set (reg:CCRAW CC_REGNUM) + (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND))] + "TARGET_HTM" + "tend" + [(set_attr "op_type" "S")]) + +; Transaction abort + +(define_expand "tabort" + [(unspec_volatile [(match_operand 0 "shift_count_or_setmem_operand" "")] + UNSPECV_TABORT)] + "TARGET_HTM && operands != NULL" +{ + if (CONST_INT_P (operands[0]) + && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 255) + { + error ("Invalid transaction abort code: " HOST_WIDE_INT_PRINT_DEC + ". Values in range 0 through 255 are reserved.", + INTVAL (operands[0])); + FAIL; + } +}) + +(define_insn "*tabort_1" + [(unspec_volatile [(match_operand 0 "shift_count_or_setmem_operand" "")] + UNSPECV_TABORT)] + "TARGET_HTM && operands != NULL" + "tabort\t%Y0" + [(set_attr "op_type" "S")]) + +; Transaction extract nesting depth + +(define_insn "etnd" + [(set (match_operand:SI 0 "register_operand" "=d") + (unspec_volatile:SI [(const_int 0)] UNSPECV_ETND))] + "TARGET_HTM" + "etnd\t%0" + [(set_attr "op_type" "RRE")]) + +; Non-transactional store + +(define_insn "ntstg" + [(set (match_operand:DI 0 "memory_operand" "=RT") + (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "d")] + UNSPECV_NTSTG))] + "TARGET_HTM" + "ntstg\t%1,%0" + [(set_attr "op_type" "RXY")]) + +; Transaction perform processor assist + +(define_expand "tx_assist" + [(set (match_dup 1) (const_int 0)) + (unspec_volatile [(match_operand:SI 0 "register_operand" "d") + (match_dup 1) + (const_int 1)] + UNSPECV_PPA)] + "TARGET_HTM" +{ + operands[1] = gen_reg_rtx (SImode); +}) + +(define_insn "*ppa" + [(unspec_volatile [(match_operand:SI 0 "register_operand" "d") + (match_operand:SI 1 "register_operand" "d") + (match_operand 2 "const_int_operand" "I")] + UNSPECV_PPA)] + "TARGET_HTM && INTVAL (operands[2]) < 16" + "ppa\t%0,%1,1" + [(set_attr "op_type" "RRF")]) diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt index b326441173c..a4e6ef25dcc 100644 --- a/gcc/config/s390/s390.opt +++ b/gcc/config/s390/s390.opt @@ -104,6 +104,10 @@ mlong-double-64 Target Report RejectNegative Negative(mlong-double-128) InverseMask(LONG_DOUBLE_128) Use 64-bit long double +mhtm +Target Report Mask(OPT_HTM) +Use hardware transactional execution instructions + mpacked-stack Target Report Mask(PACKED_STACK) Use packed stack layout diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 4eb732ef825..9c8dd89ee58 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -8786,6 +8786,7 @@ instructions, but allow the compiler to schedule those calls. * PowerPC Built-in Functions:: * PowerPC AltiVec/VSX Built-in Functions:: * RX Built-in Functions:: +* S/390 System z Built-in Functions:: * SH Built-in Functions:: * SPARC VIS Built-in Functions:: * SPU Built-in Functions:: @@ -14026,6 +14027,120 @@ bit in the processor status word. Generates the @code{wait} machine instruction. @end deftypefn +@node S/390 System z Built-in Functions +@subsection S/390 System z Built-in Functions +@deftypefn {Built-in Function} int __builtin_tbegin (void*) +Generates the @code{tbegin} machine instruction starting a +non-constraint hardware transaction. If the parameter is non-NULL the +memory area is used to store the transaction diagnostic buffer and +will be passed as first operand to @code{tbegin}. This buffer can be +defined using the @code{struct __htm_tdb} C struct defined in +@code{htmintrin.h} and must reside on a double-word boundary. The +second tbegin operand is set to @code{0xff0c}. This enables +save/restore of all GPRs and disables aborts for FPR and AR +manipulations inside the transaction body. The condition code set by +the tbegin instruction is returned as integer value. The tbegin +instruction by definition overwrites the content of all FPRs. The +compiler will generate code which saves and restores the FPRs. For +soft-float code it is recommended to used the @code{*_nofloat} +variant. In order to prevent a TDB from being written it is required +to pass an constant zero value as parameter. Passing the zero value +through a variable is not sufficient. Although modifications of +access registers inside the transaction will not trigger an +transaction abort it is not supported to actually modify them. Access +registers do not get saved when entering a transaction. They will have +undefined state when reaching the abort code. +@end deftypefn + +Macros for the possible return codes of tbegin are defined in the +@code{htmintrin.h} header file: + +@table @code +@item _HTM_TBEGIN_STARTED +@code{tbegin} has been executed as part of normal processing. The +transaction body is supposed to be executed. +@item _HTM_TBEGIN_INDETERMINATE +The transaction was aborted due to an indeterminate condition which +might be persistent. +@item _HTM_TBEGIN_TRANSIENT +The transaction aborted due to a transient failure. The transaction +should be re-executed in that case. +@item _HTM_TBEGIN_PERSISTENT +The transaction aborted due to a persistent failure. Re-execution +under same circumstances will not be productive. +@end table + +@defmac _HTM_FIRST_USER_ABORT_CODE +The @code{_HTM_FIRST_USER_ABORT_CODE} defined in @code{htmintrin.h} +specifies the first abort code which can be used for +@code{__builtin_tabort}. Values below this threshold are reserved for +machine use. +@end defmac + +@deftp {Data type} {struct __htm_tdb} +The @code{struct __htm_tdb} defined in @code{htmintrin.h} describes +the structure of the transaction diagnostic block as specified in the +Principles of Operation manual chapter 5-91. +@end deftp + +@deftypefn {Built-in Function} int __builtin_tbegin_nofloat (void*) +Same as @code{__builtin_tbegin} but without FPR saves and restores. +Using this variant in code making use of FPRs will leave the FPRs in +undefined state when entering the transaction abort handler code. +@end deftypefn + +@deftypefn {Built-in Function} int __builtin_tbegin_retry (void*, int) +In addition to @code{__builtin_tbegin} a loop for transient failures +is generated. If tbegin returns a condition code of 2 the transaction +will be retried as often as specified in the second argument. The +perform processor assist instruction is used to tell the CPU about the +number of fails so far. +@end deftypefn + +@deftypefn {Built-in Function} int __builtin_tbegin_retry_nofloat (void*, int) +Same as @code{__builtin_tbegin_retry} but without FPR saves and +restores. Using this variant in code making use of FPRs will leave +the FPRs in undefined state when entering the transaction abort +handler code. +@end deftypefn + +@deftypefn {Built-in Function} void __builtin_tbeginc (void) +Generates the @code{tbeginc} machine instruction starting a constraint +hardware transaction. The second operand is set to @code{0xff08}. +@end deftypefn + +@deftypefn {Built-in Function} int __builtin_tend (void) +Generates the @code{tend} machine instruction finishing a transaction +and making the changes visible to other threads. The condition code +generated by tend is returned as integer value. +@end deftypefn + +@deftypefn {Built-in Function} void __builtin_tabort (int) +Generates the @code{tabort} machine instruction with the specified +abort code. Abort codes from 0 through 255 are reserved and will +result in an error message. +@end deftypefn + +@deftypefn {Built-in Function} void __builtin_tx_assist (int) +Generates the @code{ppa rX,rY,1} machine instruction. Where the +integer parameter is loaded into rX and a value of zero is loaded into +rY. The integer parameter specifies the number of times the +transaction repeatedly aborted. +@end deftypefn + +@deftypefn {Built-in Function} int __builtin_tx_nesting_depth (void) +Generates the @code{etnd} machine instruction. The current nesting +depth is returned as integer value. For a nesting depth of 0 the code +is not executed as part of an transaction. +@end deftypefn + +@deftypefn {Built-in Function} void __builtin_non_tx_store (unsigned long long *, unsigned long long) + +Generates the @code{ntstg} machine instruction. The second argument +is written to the first arguments location. The store operation will +not be rolled-back in case of an transaction abort. +@end deftypefn + @node SH Built-in Functions @subsection SH Built-in Functions The following built-in functions are supported on the SH1, SH2, SH3 and SH4 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6f81dc010e3..d3037fa5410 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-08-02 Andreas Krebbel + + Backport from mainline + 2013-06-27 Andreas Krebbel + + * gcc.target/s390/htm-1.c: New file. + * gcc.target/s390/htm-nofloat-1.c: New file. + * gcc.target/s390/htm-xl-intrin-1.c: New file. + 2013-07-28 Tobias Burnus Backport from mainline diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 516f9aff99d..4f3dce55e0a 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,40 @@ +2013-08-02 Andreas Krebbel + + Backports from mainline: + 2013-04-23 Andreas Krebbel + + * config/s390/sjlj.S: New file. + * config/s390/target.h: New file. + * configure.tgt: Set options for S/390. + + 2013-06-27 Andreas Krebbel + + * config/s390/target.h: Include htmintrin.h. + (_HTM_ITM_RETRIES): New macro definition. + (htm_available, htm_init, htm_begin, htm_begin_success) + (htm_commit, htm_abort, htm_abort_should_retry): New functions. + + 2013-07-17 Andreas Krebbel + + * acinclude.m4: Add htm asm check for s390. + * configure.tgt: Add -mhtm and -Wa,-march=zEC12 to the + options. + * configure: Regenerate. + * config/s390/target.h: Remove __HTM__ check. + (htm_available): Call getauxval to get hwcaps and check + whether HTM is available or not. + + 2013-07-29 Andreas Krebbel + + * config/s390/target.h (htm_begin, htm_commit, htm_abort) + (htm_transaction_active): Enable zEC12 instructions in the + assembler. + * configure.tgt: Remove -Wa,-march=zEC12 from XCFLAGS. + + 2013-08-02 Andreas Krebbel + + * configure.tgt: Add -msoft-float to XCFLAGS. + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4 index fe32fe3e4a0..de1c8f1ec59 100644 --- a/libitm/acinclude.m4 +++ b/libitm/acinclude.m4 @@ -121,6 +121,17 @@ i[[34567]]86 | x86_64) AC_DEFINE(HAVE_AS_RTM, 1, [Define to 1 if the assembler supports RTM.]) fi ;; +s390*) + AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [ + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -march=zEC12" + AC_TRY_COMPILE([], [asm("tbegin 0,0; tend");], + [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no]) + CFLAGS="$save_CFLAGS"]) + if test x$libitm_cv_as_htm = xyes; then + AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.]) + fi + ;; esac]) sinclude(../libtool.m4) diff --git a/libitm/config.h.in b/libitm/config.h.in index 10de95ba02a..26972c7e43e 100644 --- a/libitm/config.h.in +++ b/libitm/config.h.in @@ -12,6 +12,9 @@ /* Define if your assembler supports .cfi_* directives. */ #undef HAVE_AS_CFI_PSEUDO_OP +/* Define to 1 if the assembler supports HTM. */ +#undef HAVE_AS_HTM + /* Define to 1 if the assembler supports RTM. */ #undef HAVE_AS_RTM @@ -36,6 +39,9 @@ /* Define to 1 if target has a weakref that works like the ELF one. */ #undef HAVE_ELF_STYLE_WEAKREF +/* Define to 1 if you have the `getauxval' function. */ +#undef HAVE_GETAUXVAL + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H @@ -81,6 +87,9 @@ /* Define to 1 if the target supports __sync_*_compare_and_swap */ #undef HAVE_SYNC_BUILTINS +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_AUXV_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H diff --git a/libitm/configure b/libitm/configure index d0d1abdf651..7635a4712b7 100644 --- a/libitm/configure +++ b/libitm/configure @@ -15349,7 +15349,7 @@ $as_echo "#define STRING_WITH_STRINGS 1" >>confdefs.h fi -for ac_header in unistd.h semaphore.h sys/time.h malloc.h +for ac_header in unistd.h semaphore.h sys/time.h sys/auxv.h malloc.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -16184,7 +16184,7 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext # Check for functions needed. -for ac_func in strtoull memalign posix_memalign +for ac_func in strtoull memalign posix_memalign getauxval do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -17360,9 +17360,46 @@ $as_echo "$libitm_cv_as_rtm" >&6; } $as_echo "#define HAVE_AS_RTM 1" >>confdefs.h + fi + ;; +s390*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler supports HTM" >&5 +$as_echo_n "checking if the assembler supports HTM... " >&6; } +if test "${libitm_cv_as_htm+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -march=zEC12" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm("tbegin 0,0; tend"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libitm_cv_as_htm=yes +else + libitm_cv_as_htm=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_as_htm" >&5 +$as_echo "$libitm_cv_as_htm" >&6; } + if test x$libitm_cv_as_htm = xyes; then + +$as_echo "#define HAVE_AS_HTM 1" >>confdefs.h + fi ;; esac +LIBITM_CHECK_AS_HTM { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether weak refs work like ELF" >&5 diff --git a/libitm/configure.ac b/libitm/configure.ac index ff41266a461..584a23bee20 100644 --- a/libitm/configure.ac +++ b/libitm/configure.ac @@ -160,7 +160,7 @@ AC_SUBST(libtool_VERSION) AC_STDC_HEADERS AC_HEADER_TIME ACX_HEADER_STRING -AC_CHECK_HEADERS(unistd.h semaphore.h sys/time.h malloc.h) +AC_CHECK_HEADERS(unistd.h semaphore.h sys/time.h sys/auxv.h malloc.h) GCC_HEADER_STDINT(gstdint.h) @@ -193,7 +193,7 @@ AC_LINK_IFELSE( [AC_MSG_ERROR([Pthreads are required to build libitm])])]) # Check for functions needed. -AC_CHECK_FUNCS(strtoull memalign posix_memalign) +AC_CHECK_FUNCS(strtoull memalign posix_memalign getauxval) # Check for broken semaphore implementation on darwin. # sem_init returns: sem_init error: Function not implemented. @@ -245,6 +245,7 @@ LIBITM_CHECK_SYNC_BUILTINS LIBITM_CHECK_64BIT_SYNC_BUILTINS LIBITM_CHECK_AS_AVX LIBITM_CHECK_AS_RTM +LIBITM_CHECK_AS_HTM GCC_CHECK_ELF_STYLE_WEAKREF diff --git a/libitm/configure.tgt b/libitm/configure.tgt index 84824ca16f0..0944b7b16a7 100644 --- a/libitm/configure.tgt +++ b/libitm/configure.tgt @@ -105,6 +105,10 @@ case "${target_cpu}" in XCFLAGS="${XCFLAGS} -mrtm" ARCH=x86 ;; + s390|s390x) + XCFLAGS="${XCFLAGS} -mzarch -mhtm -msoft-float" + ARCH=s390 + ;; *) ARCH="${target_cpu}" -- cgit v1.2.3 From adaada110a6c9dafd9c923ec9e89d6a0b875910c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 2 Aug 2013 17:02:43 +0000 Subject: compiler: Always put descriptor wrappers in their own section. This lets the linker GC them. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201443 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 6ae72b6a1c9..0b69d5d9887 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3582,6 +3582,12 @@ Function::make_descriptor_wrapper(Gogo* gogo, Named_object* no, Named_object* dno = gogo->start_function(name, new_fntype, false, loc); dno->func_value()->is_descriptor_wrapper_ = true; + // Put the wrapper in a unique section so that it can be discarded + // by the linker if it is not needed. Every top-level function will + // get a wrapper, in case there is a reference other than a call + // from some other package, but most will not need one. + dno->func_value()->set_in_unique_section(); + gogo->start_block(loc); Expression* fn = Expression::make_func_reference(no, NULL, loc); -- cgit v1.2.3 From 5e5c5fb7507c115d9426804b38bd34f11b9e8883 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 2 Aug 2013 18:25:22 +0000 Subject: * go-gcc.cc (immutable_struct_set_init): Always call resolve_unique_section. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201447 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 5 +++++ gcc/go/go-gcc.cc | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 094116d1b22..9e8d36ece04 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,8 @@ +2013-08-02 Ian Lance Taylor + + * go-gcc.cc (immutable_struct_set_init): Always call + resolve_unique_section. + 2013-07-24 Ian Lance Taylor * go-gcc.cc (Gcc_backend::non_zero_size_type): If a struct has a diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 27c756e5496..50dbb3128f1 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1521,10 +1521,11 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, TREE_PUBLIC(decl) = 1; } else - { - make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); - resolve_unique_section(decl, 1, 0); - } + make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); + + // These variables are often unneeded in the final program, so put + // them in their own section so that linker GC can discard them. + resolve_unique_section(decl, 1, 1); rest_of_decl_compilation(decl, 1, 0); } -- cgit v1.2.3 From b303f4ecf1147456ec6010cd01b8df8364ec252a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 2 Aug 2013 21:42:26 +0000 Subject: * config/sparc/sparc.c (sparc_emit_membar_for_model) : Add the implied StoreLoad barrier for atomic operations if before. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201451 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/sparc/sparc.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 33b097776c9..61574ced4f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-08-02 Eric Botcazou + + * config/sparc/sparc.c (sparc_emit_membar_for_model) : Add + the implied StoreLoad barrier for atomic operations if before. + 2013-08-02 Andreas Krebbel Backports from mainline: diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index fb01ae92a2a..7e87b47167f 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -11174,6 +11174,11 @@ sparc_emit_membar_for_model (enum memmodel model, /* Total Store Ordering: all memory transactions with store semantics are followed by an implied StoreStore. */ implied |= StoreStore; + + /* If we're not looking for a raw barrer (before+after), then atomic + operations get the benefit of being both load and store. */ + if (load_store == 3 && before_after == 1) + implied |= StoreLoad; /* FALLTHRU */ case SMM_PSO: -- cgit v1.2.3 From af986243fa473c0a5ce2ae2e581a8ae2516bf22c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 2 Aug 2013 22:30:42 +0000 Subject: syscall: Change AWK split call to use []+ rather than []*. Using []* fails with the awk that is part of busybox: https://groups.google.com/d/msg/gofrontend-dev/NbQsG_AMDpY/sXCc03kkwn4J git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201456 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/syscall/mksyscall.awk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgo/go/syscall/mksyscall.awk b/libgo/go/syscall/mksyscall.awk index 74f0e28af4d..daf6554a6cd 100644 --- a/libgo/go/syscall/mksyscall.awk +++ b/libgo/go/syscall/mksyscall.awk @@ -53,7 +53,7 @@ BEGIN { } # Sets a[1] = //sysnb, a[2] == function name. - split(line, a, "[ (]*") + split(line, a, "[ (]+") gofnname = a[2] off = match(line, "\\([^()]*\\)") @@ -78,7 +78,7 @@ BEGIN { next } - split(line, a, "[ (]*") + split(line, a, "[ (]+") cfnname = substr(a[1], 3, length(a[1]) - 2) off = match(line, "\\([^()]*\\)") -- cgit v1.2.3 From 46a75a962670e8e4f2ee120858e5f185bb5eedae Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 3 Aug 2013 00:16:32 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201460 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 65141bf210f..cd808006206 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130802 +20130803 -- cgit v1.2.3 From a146237ba4b8097f45094ff2113f37fc59c098fc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 4 Aug 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201472 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cd808006206..59492e23f0a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130803 +20130804 -- cgit v1.2.3 From 62cebf4bac02c2bc9177e651111e58af9874a7f8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 5 Aug 2013 00:16:43 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201477 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 59492e23f0a..536e3b3bccc 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130804 +20130805 -- cgit v1.2.3 From f7a7f40556401427c1d24312195dc5a390dfe2bf Mon Sep 17 00:00:00 2001 From: Jack Howarth Date: Mon, 5 Aug 2013 16:02:08 +0000 Subject: Remove: 2013-07-10 Jack Howarth PR target/57792 * configure.ac: Use --with-sysroot=\"`xcrun --show-sdk-path`\" on darwin13 and later. * configure: Regenerated. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201495 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog | 6 ------ configure | 7 ------- configure.ac | 7 ------- 3 files changed, 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65bc276e2de..1d0f9d736ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,3 @@ -2013-07-10 Jack Howarth - - PR target/57792 - * configure.ac: Use --with-sysroot=\"`xcrun --show-sdk-path`\" on darwin13 and later. - * configure: Regenerated. - 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/configure b/configure index b790d6555bf..d809535ed0a 100755 --- a/configure +++ b/configure @@ -7414,13 +7414,6 @@ if test x${is_cross_compiler} = xyes ; then target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}" fi -# Pass --with-sysroot on darwin without SDK in / -case "${target}" in - x86_64-*-darwin1[3-9]*) - host_configargs="--with-sysroot=\"`xcrun --show-sdk-path`\" ${host_configargs}" - ;; -esac - # Default to --enable-multilib. if test x${enable_multilib} = x ; then target_configargs="--enable-multilib ${target_configargs}" diff --git a/configure.ac b/configure.ac index 93a456f150b..48ec1aae6b4 100644 --- a/configure.ac +++ b/configure.ac @@ -2848,13 +2848,6 @@ if test x${is_cross_compiler} = xyes ; then target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}" fi -# Pass --with-sysroot on darwin without SDK in / -case "${target}" in - x86_64-*-darwin1[[3-9]]*) - host_configargs="--with-sysroot=\"`xcrun --show-sdk-path`\" ${host_configargs}" - ;; -esac - # Default to --enable-multilib. if test x${enable_multilib} = x ; then target_configargs="--enable-multilib ${target_configargs}" -- cgit v1.2.3 From 4424520793854f340df8525512f4ab2d919a4006 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Mon, 5 Aug 2013 20:24:39 +0000 Subject: PR rtl-optimization/57708 * recog.c (peep2_find_free_register): Validate all regs in a multi-reg mode. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201510 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/recog.c | 64 +++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 49 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61574ced4f5..1265ca28754 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-05 Richard Earnshaw + + PR rtl-optimization/57708 + * recog.c (peep2_find_free_register): Validate all regs in a + multi-reg mode. + 2013-08-02 Eric Botcazou * config/sparc/sparc.c (sparc_emit_membar_for_model) : Add diff --git a/gcc/recog.c b/gcc/recog.c index ae394b9b118..f00859cf00a 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3120,32 +3120,53 @@ peep2_find_free_register (int from, int to, const char *class_str, regno = raw_regno; #endif - /* Don't allocate fixed registers. */ - if (fixed_regs[regno]) - continue; - /* Don't allocate global registers. */ - if (global_regs[regno]) - continue; - /* Make sure the register is of the right class. */ - if (! TEST_HARD_REG_BIT (reg_class_contents[cl], regno)) - continue; - /* And can support the mode we need. */ + /* Can it support the mode we need? */ if (! HARD_REGNO_MODE_OK (regno, mode)) continue; - /* And that we don't create an extra save/restore. */ - if (! call_used_regs[regno] && ! df_regs_ever_live_p (regno)) - continue; - if (! targetm.hard_regno_scratch_ok (regno)) - continue; - - /* And we don't clobber traceback for noreturn functions. */ - if ((regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM) - && (! reload_completed || frame_pointer_needed)) - continue; success = 1; - for (j = hard_regno_nregs[regno][mode] - 1; j >= 0; j--) + for (j = 0; success && j < hard_regno_nregs[regno][mode]; j++) { + /* Don't allocate fixed registers. */ + if (fixed_regs[regno + j]) + { + success = 0; + break; + } + /* Don't allocate global registers. */ + if (global_regs[regno + j]) + { + success = 0; + break; + } + /* Make sure the register is of the right class. */ + if (! TEST_HARD_REG_BIT (reg_class_contents[cl], regno + j)) + { + success = 0; + break; + } + /* And that we don't create an extra save/restore. */ + if (! call_used_regs[regno + j] && ! df_regs_ever_live_p (regno + j)) + { + success = 0; + break; + } + + if (! targetm.hard_regno_scratch_ok (regno + j)) + { + success = 0; + break; + } + + /* And we don't clobber traceback for noreturn functions. */ + if ((regno + j == FRAME_POINTER_REGNUM + || regno + j == HARD_FRAME_POINTER_REGNUM) + && (! reload_completed || frame_pointer_needed)) + { + success = 0; + break; + } + if (TEST_HARD_REG_BIT (*reg_set, regno + j) || TEST_HARD_REG_BIT (live, regno + j)) { @@ -3153,6 +3174,7 @@ peep2_find_free_register (int from, int to, const char *class_str, break; } } + if (success) { add_to_hard_reg_set (reg_set, mode, regno); -- cgit v1.2.3 From 51e885d37dc56372bb61cbdb18660f6932d74aed Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 6 Aug 2013 00:16:21 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201515 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 536e3b3bccc..f801f84461f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130805 +20130806 -- cgit v1.2.3 From 612c675be2e91b82dd16913cf41a861ae631b5b3 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Tue, 6 Aug 2013 15:08:59 +0000 Subject: 2013-08-06 Martin Jambor PR middle-end/58041 * gimple-ssa-strength-reduction.c (replace_ref): Make sure built MEM_REF has proper alignment information. testsuite/ * gcc.dg/torture/pr58041.c: New test. * gcc.target/arm/pr58041.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201530 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/gimple-ssa-strength-reduction.c | 22 ++++++++++++++++----- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/torture/pr58041.c | 35 ++++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.target/arm/pr58041.c | 30 +++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58041.c create mode 100644 gcc/testsuite/gcc.target/arm/pr58041.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1265ca28754..6cd85609ba5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-06 Martin Jambor + + PR middle-end/58041 + * gimple-ssa-strength-reduction.c (replace_ref): Make sure built + MEM_REF has proper alignment information. + 2013-08-05 Richard Earnshaw PR rtl-optimization/57708 diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 57b343ab5cf..5cda3873eb3 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -1525,11 +1525,23 @@ unconditional_cands_with_known_stride_p (slsr_cand_t root) static void replace_ref (tree *expr, slsr_cand_t c) { - tree add_expr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (c->base_expr), - c->base_expr, c->stride); - tree mem_ref = fold_build2 (MEM_REF, TREE_TYPE (*expr), add_expr, - double_int_to_tree (c->cand_type, c->index)); - + tree add_expr, mem_ref, acc_type = TREE_TYPE (*expr); + unsigned HOST_WIDE_INT misalign; + unsigned align; + + /* Ensure the memory reference carries the minimum alignment + requirement for the data type. See PR58041. */ + get_object_alignment_1 (*expr, &align, &misalign); + if (misalign != 0) + align = (misalign & -misalign); + if (align < TYPE_ALIGN (acc_type)) + acc_type = build_aligned_type (acc_type, align); + + add_expr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (c->base_expr), + c->base_expr, c->stride); + mem_ref = fold_build2 (MEM_REF, acc_type, add_expr, + double_int_to_tree (c->cand_type, c->index)); + /* Gimplify the base addressing expression for the new MEM_REF tree. */ gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); TREE_OPERAND (mem_ref, 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d3037fa5410..9aedc93d548 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-08-06 Martin Jambor + + PR middle-end/58041 + * gcc.dg/torture/pr58041.c: New test. + * gcc.target/arm/pr58041.c: Likewise. + 2013-08-02 Andreas Krebbel Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr58041.c b/gcc/testsuite/gcc.dg/torture/pr58041.c new file mode 100644 index 00000000000..e22ec3c86ab --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58041.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +typedef long long V + __attribute__ ((vector_size (2 * sizeof (long long)), may_alias)); + +typedef struct S { V v; } P __attribute__((aligned (1))); + +struct s +{ + char u; + V v[2]; +} __attribute__((packed,aligned(1))); + +__attribute__((noinline, noclone)) +long long foo(struct s *x, int y, V z) +{ + V a = x->v[y]; + x->v[y] = z; + return a[1]; +} + +struct s a = {0,{0,0}}; +int main() +{ + V v1 = {0,1}; + V v2 = {0,2}; + + if (foo(&a,0,v1) != 0) + __builtin_abort(); + if (foo(&a,0,v2) != 1) + __builtin_abort(); + if (foo(&a,1,v1) != 0) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/pr58041.c b/gcc/testsuite/gcc.target/arm/pr58041.c new file mode 100644 index 00000000000..481a72b81c7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr58041.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -mno-unaligned-access" } */ +/* { dg-final { scan-assembler "ldrb" } } */ +/* { dg-final { scan-assembler "strb" } } */ + +struct s +{ + char u; + long long v[2]; +} __attribute__((packed,aligned(1))); + +__attribute__((noinline, noclone)) +long long foo(struct s *x, int y, long long z) +{ + long long a = x->v[y]; + x->v[y] = z; + return a; +} + +struct s a = {0,{0,0}}; +int main() +{ + if (foo(&a,0,1) != 0) + __builtin_abort(); + if (foo(&a,0,2) != 1) + __builtin_abort(); + if (foo(&a,1,1) != 0) + __builtin_abort(); + return 0; +} -- cgit v1.2.3 From bd40dad5cf3c464d9b57ae02d5035a71f06f24fc Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 6 Aug 2013 16:40:25 +0000 Subject: * go-gcc.cc (Gcc_backend::immutable_struct_set_init): Use compute_reloc_for_constant. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201536 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 5 +++++ gcc/go/go-gcc.cc | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 9e8d36ece04..3e77c2929b5 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,8 @@ +2013-08-06 Ian Lance Taylor + + * go-gcc.cc (Gcc_backend::immutable_struct_set_init): Use + compute_reloc_for_constant. + 2013-08-02 Ian Lance Taylor * go-gcc.cc (immutable_struct_set_init): Always call diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 50dbb3128f1..1ecfaffd73a 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1525,7 +1525,9 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, // These variables are often unneeded in the final program, so put // them in their own section so that linker GC can discard them. - resolve_unique_section(decl, 1, 1); + resolve_unique_section(decl, + compute_reloc_for_constant (init_tree), + 1); rest_of_decl_compilation(decl, 1, 0); } -- cgit v1.2.3 From caf4616d87c818c76d4c6fc1cd459f8cf8f7fa57 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Tue, 6 Aug 2013 17:35:11 +0000 Subject: 2013-08-06 Martin Jambor Bernd Edlinger testsuite/ * gcc.dg/torture/pr58041.c (foo): Accept z by reference. (a): Fix constructor. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201539 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/torture/pr58041.c | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aedc93d548..2ae433c9ff1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-08-06 Martin Jambor + Bernd Edlinger + + * gcc.dg/torture/pr58041.c (foo): Accept z by reference. + (a): Fix constructor. + 2013-08-06 Martin Jambor PR middle-end/58041 diff --git a/gcc/testsuite/gcc.dg/torture/pr58041.c b/gcc/testsuite/gcc.dg/torture/pr58041.c index e22ec3c86ab..169a71ae7e4 100644 --- a/gcc/testsuite/gcc.dg/torture/pr58041.c +++ b/gcc/testsuite/gcc.dg/torture/pr58041.c @@ -3,8 +3,6 @@ typedef long long V __attribute__ ((vector_size (2 * sizeof (long long)), may_alias)); -typedef struct S { V v; } P __attribute__((aligned (1))); - struct s { char u; @@ -12,24 +10,24 @@ struct s } __attribute__((packed,aligned(1))); __attribute__((noinline, noclone)) -long long foo(struct s *x, int y, V z) +long long foo(struct s *x, int y, V *z) { V a = x->v[y]; - x->v[y] = z; + x->v[y] = *z; return a[1]; } -struct s a = {0,{0,0}}; +struct s a = {0,{{0,0},{0,0}}}; int main() { V v1 = {0,1}; V v2 = {0,2}; - if (foo(&a,0,v1) != 0) + if (foo(&a,0,&v1) != 0) __builtin_abort(); - if (foo(&a,0,v2) != 1) + if (foo(&a,0,&v2) != 1) __builtin_abort(); - if (foo(&a,1,v1) != 0) + if (foo(&a,1,&v1) != 0) __builtin_abort(); return 0; } -- cgit v1.2.3 From ec6ccc40a00dea72fbd0d2a0eb2822ef899bcc24 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 7 Aug 2013 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201547 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f801f84461f..44f197d44ee 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130806 +20130807 -- cgit v1.2.3 From 84c0c53dc5a4d2343f53588ebcf4bdde0f0f1738 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 7 Aug 2013 01:18:57 +0000 Subject: PR c++/57825 * tree.c (strip_typedefs) [METHOD_TYPE]: Preserve ref-qualifier. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201551 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 2 ++ gcc/testsuite/g++.dg/cpp0x/ref-qual14.C | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/ref-qual14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 20e9ebaa646..fde680d0def 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-08-06 Jason Merrill + + PR c++/57825 + * tree.c (strip_typedefs) [METHOD_TYPE]: Preserve ref-qualifier. + 2013-07-29 Jason Merrill PR c++/57901 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a75663406d4..c7502d6207b 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1220,6 +1220,8 @@ strip_typedefs (tree t) result = build_method_type_directly (class_type, type, TREE_CHAIN (arg_types)); + result + = build_ref_qualified_type (result, type_memfn_rqual (t)); } else { diff --git a/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C b/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C new file mode 100644 index 00000000000..8e55551aeb2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/ref-qual14.C @@ -0,0 +1,18 @@ +// PR c++/57825 +// { dg-do compile { target c++11 } } + +template +struct target_class +{}; + +template +struct target_class +{}; + +template +struct target_class +{}; + +template +struct target_class +{}; -- cgit v1.2.3 From 6542e280b40e0f973926851623dc8707225d170b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 7 Aug 2013 12:13:24 +0000 Subject: 2013-08-07 Paolo Carlini PR libstdc++/58098 * include/bits/random.h (cauchy_distribution<>::min, extreme_value_distribution<>::min, normal_distribution<>::min, student_t_distribution<>::min): Fix. * include/ext/random (normal_mv_distribution<>::min): Likewise. * testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc: Adjust. testsuite/26_numerics/random/cauchy_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/extreme_value_distribution/cons/ parms.cc: Likewise. testsuite/26_numerics/random/extreme_value_distribution/cons/ default.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/default.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/exponential_distribution/cons/parms.cc: Minor tweak. * testsuite/26_numerics/random/exponential_distribution/cons/default.cc: Likewise. * testsuite/ext/von_mises_distribution/*: Move to... * testsuite/ext/random/von_mises_distribution/*: ... here. * testsuite/ext/triangular_distribution/*: Move to... * testsuite/ext/random/triangular_distribution/*: ... here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201563 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 36 ++++++++++++++++++ libstdc++-v3/include/bits/random.h | 8 ++-- libstdc++-v3/include/ext/random | 2 +- .../random/cauchy_distribution/cons/default.cc | 2 +- .../random/cauchy_distribution/cons/parms.cc | 2 +- .../exponential_distribution/cons/default.cc | 2 +- .../random/exponential_distribution/cons/parms.cc | 2 +- .../extreme_value_distribution/cons/default.cc | 2 +- .../extreme_value_distribution/cons/parms.cc | 2 +- .../random/normal_distribution/cons/default.cc | 2 +- .../random/normal_distribution/cons/parms.cc | 2 +- .../random/student_t_distribution/cons/default.cc | 2 +- .../random/student_t_distribution/cons/parms.cc | 2 +- .../random/normal_mv_distribution/cons/default.cc | 4 +- .../random/normal_mv_distribution/cons/parms.cc | 4 +- .../random/triangular_distribution/cons/default.cc | 0 .../random/triangular_distribution/cons/parms.cc | 0 .../triangular_distribution/operators/equal.cc | 0 .../triangular_distribution/operators/inequal.cc | 0 .../triangular_distribution/operators/serialize.cc | 0 .../requirements/explicit_instantiation/1.cc | 0 .../requirements/typedefs.cc | 0 .../random/von_mises_distribution/cons/default.cc | 0 .../random/von_mises_distribution/cons/parms.cc | 0 .../von_mises_distribution/operators/equal.cc | 0 .../von_mises_distribution/operators/inequal.cc | 0 .../von_mises_distribution/operators/serialize.cc | 0 .../requirements/explicit_instantiation/1.cc | 0 .../requirements/typedefs.cc | 0 .../ext/triangular_distribution/cons/default.cc | 44 ---------------------- .../ext/triangular_distribution/cons/parms.cc | 44 ---------------------- .../ext/triangular_distribution/operators/equal.cc | 42 --------------------- .../triangular_distribution/operators/inequal.cc | 42 --------------------- .../triangular_distribution/operators/serialize.cc | 44 ---------------------- .../requirements/explicit_instantiation/1.cc | 26 ------------- .../requirements/typedefs.cc | 34 ----------------- .../ext/von_mises_distribution/cons/default.cc | 43 --------------------- .../ext/von_mises_distribution/cons/parms.cc | 43 --------------------- .../ext/von_mises_distribution/operators/equal.cc | 42 --------------------- .../von_mises_distribution/operators/inequal.cc | 42 --------------------- .../von_mises_distribution/operators/serialize.cc | 44 ---------------------- .../requirements/explicit_instantiation/1.cc | 26 ------------- .../requirements/typedefs.cc | 34 ----------------- 43 files changed, 55 insertions(+), 569 deletions(-) create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc create mode 100644 libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/cons/default.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/cons/parms.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/operators/equal.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/operators/inequal.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/operators/serialize.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/requirements/explicit_instantiation/1.cc delete mode 100644 libstdc++-v3/testsuite/ext/triangular_distribution/requirements/typedefs.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/cons/default.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/cons/parms.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/operators/equal.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/operators/inequal.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/operators/serialize.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/explicit_instantiation/1.cc delete mode 100644 libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/typedefs.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cdab3e72cd1..2bc9beed97e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,39 @@ +2013-08-07 Paolo Carlini + + PR libstdc++/58098 + * include/bits/random.h (cauchy_distribution<>::min, + extreme_value_distribution<>::min, normal_distribution<>::min, + student_t_distribution<>::min): Fix. + * include/ext/random (normal_mv_distribution<>::min): Likewise. + * testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc: + Adjust. + testsuite/26_numerics/random/cauchy_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/extreme_value_distribution/cons/ + parms.cc: Likewise. + testsuite/26_numerics/random/extreme_value_distribution/cons/ + default.cc: Likewise. + * testsuite/26_numerics/random/normal_distribution/cons/parms.cc: + Likewise. + * testsuite/26_numerics/random/normal_distribution/cons/default.cc: + Likewise. + * testsuite/26_numerics/random/student_t_distribution/cons/parms.cc: + Likewise. + * testsuite/26_numerics/random/student_t_distribution/cons/default.cc: + Likewise. + * testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise. + * testsuite/ext/random/normal_mv_distribution/cons/default.cc: Likewise. + + * testsuite/26_numerics/random/exponential_distribution/cons/parms.cc: + Minor tweak. + * testsuite/26_numerics/random/exponential_distribution/cons/default.cc: + Likewise. + + * testsuite/ext/von_mises_distribution/*: Move to... + * testsuite/ext/random/von_mises_distribution/*: ... here. + * testsuite/ext/triangular_distribution/*: Move to... + * testsuite/ext/random/triangular_distribution/*: ... here. + 2013-07-31 François Dumont * include/profile/unordered_base.h: New. diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index caabe906058..c37d2f329ca 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -2178,7 +2178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ result_type min() const - { return std::numeric_limits::min(); } + { return std::numeric_limits::lowest(); } /** * @brief Returns the least upper bound value of the distribution. @@ -3011,7 +3011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ result_type min() const - { return std::numeric_limits::min(); } + { return std::numeric_limits::lowest(); } /** * @brief Returns the least upper bound value of the distribution. @@ -3428,7 +3428,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ result_type min() const - { return std::numeric_limits::min(); } + { return std::numeric_limits::lowest(); } /** * @brief Returns the least upper bound value of the distribution. @@ -5136,7 +5136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ result_type min() const - { return std::numeric_limits::min(); } + { return std::numeric_limits::lowest(); } /** * @brief Returns the least upper bound value of the distribution. diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 5f365e65a33..347ebed449c 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -791,7 +791,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type min() const { result_type __res; - __res.fill(std::numeric_limits<_RealType>::min()); + __res.fill(std::numeric_limits<_RealType>::lowest()); return __res; } /** diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc index 37455cea5cb..2a3465b86d1 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.a() == 0.0 ); VERIFY( u.b() == 1.0 ); typedef std::cauchy_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc index 2ac096b451f..67fb17172e5 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.a() == 5.0 ); VERIFY( u.b() == 2.0 ); typedef std::cauchy_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc index 486a1b2f2a7..f84b1307ed7 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc @@ -34,7 +34,7 @@ test01() std::exponential_distribution<> u; VERIFY( u.lambda() == 1.0 ); typedef std::exponential_distribution<>::result_type result_type; - VERIFY( u.min() == 0 ); + VERIFY( u.min() == 0.0 ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc index d1fc4dc5f13..ef2decfccd1 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc @@ -34,7 +34,7 @@ test01() std::exponential_distribution<> u(0.5); VERIFY( u.lambda() == 0.5 ); typedef std::exponential_distribution<>::result_type result_type; - VERIFY( u.min() == 0 ); + VERIFY( u.min() == 0.0 ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc index a8845e4d028..c14c49ce315 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.a() == 0.0 ); VERIFY( u.b() == 1.0 ); typedef std::extreme_value_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc index daa20b5e384..786847f2fb0 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.a() == 5.0 ); VERIFY( u.b() == 2.0 ); typedef std::extreme_value_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc index 2ffa3305a81..8beb8bd2d2e 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.mean() == 0.0 ); VERIFY( u.stddev() == 1.0 ); typedef std::normal_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc index 0c2b79905c7..ea87162c6c6 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc @@ -35,7 +35,7 @@ test01() VERIFY( u.mean() == 5.0 ); VERIFY( u.stddev() == 2.0 ); typedef std::normal_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc index 8318b37a8b5..0b5b8fa301e 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc @@ -34,7 +34,7 @@ test01() std::student_t_distribution<> u; VERIFY( u.n() == 1.0 ); typedef std::student_t_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc index fb3dc052837..1b9996212cf 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc @@ -34,7 +34,7 @@ test01() std::student_t_distribution<> u(1.5); VERIFY( u.n() == 1.5 ); typedef std::student_t_distribution<>::result_type result_type; - VERIFY( u.min() == std::numeric_limits::min() ); + VERIFY( u.min() == std::numeric_limits::lowest() ); VERIFY( u.max() == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc index db3db480a70..80ad819797c 100644 --- a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/default.cc @@ -36,9 +36,9 @@ test01() VERIFY( u.varcov()[1] == 0.0 ); VERIFY( u.varcov()[2] == 1.0 ); typedef __gnu_cxx::normal_mv_distribution<2>::result_type result_type; - VERIFY( u.min()[0] == std::numeric_limits::min() ); + VERIFY( u.min()[0] == std::numeric_limits::lowest() ); VERIFY( u.max()[0] == std::numeric_limits::max() ); - VERIFY( u.min()[1] == std::numeric_limits::min() ); + VERIFY( u.min()[1] == std::numeric_limits::lowest() ); VERIFY( u.max()[1] == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/parms.cc index b546d0793d4..3c51e7db20a 100644 --- a/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/ext/random/normal_mv_distribution/cons/parms.cc @@ -36,9 +36,9 @@ test01() VERIFY( u.varcov()[1] == 0.0 ); VERIFY( u.varcov()[2] == 3.0 ); typedef __gnu_cxx::normal_mv_distribution<2>::result_type result_type; - VERIFY( u.min()[0] == std::numeric_limits::min() ); + VERIFY( u.min()[0] == std::numeric_limits::lowest() ); VERIFY( u.max()[0] == std::numeric_limits::max() ); - VERIFY( u.min()[1] == std::numeric_limits::min() ); + VERIFY( u.min()[1] == std::numeric_limits::lowest() ); VERIFY( u.max()[1] == std::numeric_limits::max() ); } diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/cons/default.cc deleted file mode 100644 index 63303f81e6b..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/cons/default.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::triangular_distribution<> u; - VERIFY( u.a() == 0.0 ); - VERIFY( u.b() == 0.5 ); - VERIFY( u.c() == 1.0 ); - VERIFY( u.min() == 0.0 ); - VERIFY( u.max() == 1.0 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/cons/parms.cc deleted file mode 100644 index 8380965df46..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/cons/parms.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::triangular_distribution<> u(1.5, 3.0, 3.5); - VERIFY( u.a() == 1.5 ); - VERIFY( u.b() == 3.0 ); - VERIFY( u.c() == 3.5 ); - VERIFY( u.min() == 1.5 ); - VERIFY( u.max() == 3.5 ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/operators/equal.cc deleted file mode 100644 index c38ea4c58c4..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/equal.cc +++ /dev/null @@ -1,42 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2010-03-16 Paolo Carlini -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::triangular_distribution u(1.5, 3.0, 4.0), v, w; - - VERIFY( v == w ); - VERIFY( !(u == v) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/operators/inequal.cc deleted file mode 100644 index c4a014ea2c8..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/inequal.cc +++ /dev/null @@ -1,42 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2010-03-16 Paolo Carlini -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::triangular_distribution u(1.5, 3.0, 5.0), v, w; - - VERIFY( u != v ); - VERIFY( !(v != w) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/operators/serialize.cc deleted file mode 100644 index 7878376d93a..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/operators/serialize.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - std::stringstream str; - __gnu_cxx::triangular_distribution u(1.5, 3.0, 4.5), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - str >> v; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/explicit_instantiation/1.cc deleted file mode 100644 index 189bdaf80c1..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/explicit_instantiation/1.cc +++ /dev/null @@ -1,26 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=c++11" } -// { dg-require-cstdint "" } -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -template class __gnu_cxx::triangular_distribution; -template class __gnu_cxx::triangular_distribution; -template class __gnu_cxx::triangular_distribution; diff --git a/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/typedefs.cc deleted file mode 100644 index 835e8e7e9c7..00000000000 --- a/libstdc++-v3/testsuite/ext/triangular_distribution/requirements/typedefs.cc +++ /dev/null @@ -1,34 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -void -test01() -{ - typedef __gnu_cxx::triangular_distribution test_type; - - typedef test_type::result_type result_type; - typedef test_type::param_type param_type; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/default.cc deleted file mode 100644 index 3183c85ed7e..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/default.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::von_mises_distribution<> u; - VERIFY( u.mu() == 0.0 ); - VERIFY( u.kappa() == 1.0 ); - VERIFY( u.min() == -__gnu_cxx::__math_constants::__pi ); - VERIFY( u.max() == __gnu_cxx::__math_constants::__pi ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/parms.cc deleted file mode 100644 index 6c1f8f73007..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/cons/parms.cc +++ /dev/null @@ -1,43 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::von_mises_distribution<> u(1.5, 3.0); - VERIFY( u.mu() == 1.5 ); - VERIFY( u.kappa() == 3.0 ); - VERIFY( u.min() == -__gnu_cxx::__math_constants::__pi ); - VERIFY( u.max() == __gnu_cxx::__math_constants::__pi ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/equal.cc deleted file mode 100644 index 569a9aae944..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/equal.cc +++ /dev/null @@ -1,42 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2010-03-16 Paolo Carlini -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::von_mises_distribution u(1.5, 3.0), v, w; - - VERIFY( v == w ); - VERIFY( !(u == v) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/inequal.cc deleted file mode 100644 index a4d2d8ddfbd..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/inequal.cc +++ /dev/null @@ -1,42 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2010-03-16 Paolo Carlini -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - bool test __attribute__((unused)) = true; - - __gnu_cxx::von_mises_distribution u(1.5, 3.0), v, w; - - VERIFY( u != v ); - VERIFY( !(v != w) ); -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/serialize.cc deleted file mode 100644 index 5437c136ae8..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/operators/serialize.cc +++ /dev/null @@ -1,44 +0,0 @@ -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -void -test01() -{ - std::stringstream str; - __gnu_cxx::von_mises_distribution u(1.5, 3.0), v; - std::minstd_rand0 rng; - - u(rng); // advance - str << u; - - str >> v; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/explicit_instantiation/1.cc deleted file mode 100644 index d93093f4d8f..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/explicit_instantiation/1.cc +++ /dev/null @@ -1,26 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=c++11" } -// { dg-require-cstdint "" } -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -template class __gnu_cxx::von_mises_distribution; -template class __gnu_cxx::von_mises_distribution; -template class __gnu_cxx::von_mises_distribution; diff --git a/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/typedefs.cc deleted file mode 100644 index c8c34abd3e2..00000000000 --- a/libstdc++-v3/testsuite/ext/von_mises_distribution/requirements/typedefs.cc +++ /dev/null @@ -1,34 +0,0 @@ -// { dg-do compile } -// { dg-options "-std=c++0x" } -// { dg-require-cstdint "" } -// -// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> -// 2013-03-02 Ulrich Drepper -// -// Copyright (C) 2013 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include - -void -test01() -{ - typedef __gnu_cxx::von_mises_distribution test_type; - - typedef test_type::result_type result_type; - typedef test_type::param_type param_type; -} -- cgit v1.2.3 From 9ac1464c8e6fffa719b7c154bc7277c4ab1520dc Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 7 Aug 2013 12:23:15 +0000 Subject: 2013-08-07 Paolo Carlini PR libstdc++/58098 * include/bits/random.h (cauchy_distribution<>::min, extreme_value_distribution<>::min, normal_distribution<>::min, student_t_distribution<>::min): Fix. * include/ext/random (normal_mv_distribution<>::min): Likewise. * testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc: Adjust. testsuite/26_numerics/random/cauchy_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/extreme_value_distribution/cons/ parms.cc: Likewise. testsuite/26_numerics/random/extreme_value_distribution/cons/ default.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/normal_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/parms.cc: Likewise. * testsuite/26_numerics/random/student_t_distribution/cons/default.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/parms.cc: Likewise. * testsuite/ext/random/normal_mv_distribution/cons/default.cc: Likewise. * testsuite/26_numerics/random/exponential_distribution/cons/parms.cc: Minor tweak. * testsuite/26_numerics/random/exponential_distribution/cons/default.cc: Likewise. * testsuite/ext/von_mises_distribution/*: Move to... * testsuite/ext/random/von_mises_distribution/*: ... here. * testsuite/ext/triangular_distribution/*: Move to... * testsuite/ext/random/triangular_distribution/*: ... here. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201564 138bc75d-0d04-0410-961f-82ee72b054a4 --- .../random/triangular_distribution/cons/default.cc | 44 ++++++++++++++++++++++ .../random/triangular_distribution/cons/parms.cc | 44 ++++++++++++++++++++++ .../triangular_distribution/operators/equal.cc | 42 +++++++++++++++++++++ .../triangular_distribution/operators/inequal.cc | 42 +++++++++++++++++++++ .../triangular_distribution/operators/serialize.cc | 44 ++++++++++++++++++++++ .../requirements/explicit_instantiation/1.cc | 26 +++++++++++++ .../requirements/typedefs.cc | 34 +++++++++++++++++ .../random/von_mises_distribution/cons/default.cc | 43 +++++++++++++++++++++ .../random/von_mises_distribution/cons/parms.cc | 43 +++++++++++++++++++++ .../von_mises_distribution/operators/equal.cc | 42 +++++++++++++++++++++ .../von_mises_distribution/operators/inequal.cc | 42 +++++++++++++++++++++ .../von_mises_distribution/operators/serialize.cc | 44 ++++++++++++++++++++++ .../requirements/explicit_instantiation/1.cc | 26 +++++++++++++ .../requirements/typedefs.cc | 34 +++++++++++++++++ 14 files changed, 550 insertions(+) diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc index e69de29bb2d..63303f81e6b 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/default.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::triangular_distribution<> u; + VERIFY( u.a() == 0.0 ); + VERIFY( u.b() == 0.5 ); + VERIFY( u.c() == 1.0 ); + VERIFY( u.min() == 0.0 ); + VERIFY( u.max() == 1.0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc index e69de29bb2d..8380965df46 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/cons/parms.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::triangular_distribution<> u(1.5, 3.0, 3.5); + VERIFY( u.a() == 1.5 ); + VERIFY( u.b() == 3.0 ); + VERIFY( u.c() == 3.5 ); + VERIFY( u.min() == 1.5 ); + VERIFY( u.max() == 3.5 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc index e69de29bb2d..c38ea4c58c4 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/equal.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::triangular_distribution u(1.5, 3.0, 4.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc index e69de29bb2d..c4a014ea2c8 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/inequal.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::triangular_distribution u(1.5, 3.0, 5.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc index e69de29bb2d..7878376d93a 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/operators/serialize.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + std::stringstream str; + __gnu_cxx::triangular_distribution u(1.5, 3.0, 4.5), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc index e69de29bb2d..189bdaf80c1 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/explicit_instantiation/1.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=c++11" } +// { dg-require-cstdint "" } +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +template class __gnu_cxx::triangular_distribution; +template class __gnu_cxx::triangular_distribution; +template class __gnu_cxx::triangular_distribution; diff --git a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc index e69de29bb2d..835e8e7e9c7 100644 --- a/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/ext/random/triangular_distribution/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef __gnu_cxx::triangular_distribution test_type; + + typedef test_type::result_type result_type; + typedef test_type::param_type param_type; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc index e69de29bb2d..3183c85ed7e 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/default.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::von_mises_distribution<> u; + VERIFY( u.mu() == 0.0 ); + VERIFY( u.kappa() == 1.0 ); + VERIFY( u.min() == -__gnu_cxx::__math_constants::__pi ); + VERIFY( u.max() == __gnu_cxx::__math_constants::__pi ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc index e69de29bb2d..6c1f8f73007 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/cons/parms.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::von_mises_distribution<> u(1.5, 3.0); + VERIFY( u.mu() == 1.5 ); + VERIFY( u.kappa() == 3.0 ); + VERIFY( u.min() == -__gnu_cxx::__math_constants::__pi ); + VERIFY( u.max() == __gnu_cxx::__math_constants::__pi ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc index e69de29bb2d..569a9aae944 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/equal.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::von_mises_distribution u(1.5, 3.0), v, w; + + VERIFY( v == w ); + VERIFY( !(u == v) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc index e69de29bb2d..a4d2d8ddfbd 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/inequal.cc @@ -0,0 +1,42 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2010-03-16 Paolo Carlini +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::von_mises_distribution u(1.5, 3.0), v, w; + + VERIFY( u != v ); + VERIFY( !(v != w) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc index e69de29bb2d..5437c136ae8 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/operators/serialize.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +void +test01() +{ + std::stringstream str; + __gnu_cxx::von_mises_distribution u(1.5, 3.0), v; + std::minstd_rand0 rng; + + u(rng); // advance + str << u; + + str >> v; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc index e69de29bb2d..d93093f4d8f 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/explicit_instantiation/1.cc @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-std=c++11" } +// { dg-require-cstdint "" } +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +template class __gnu_cxx::von_mises_distribution; +template class __gnu_cxx::von_mises_distribution; +template class __gnu_cxx::von_mises_distribution; diff --git a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc index e69de29bb2d..c8c34abd3e2 100644 --- a/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/ext/random/von_mises_distribution/requirements/typedefs.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } +// { dg-require-cstdint "" } +// +// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net> +// 2013-03-02 Ulrich Drepper +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void +test01() +{ + typedef __gnu_cxx::von_mises_distribution test_type; + + typedef test_type::result_type result_type; + typedef test_type::param_type param_type; +} -- cgit v1.2.3 From 7ec99e05dfc062968667192ad5ef6a40c2fbc82b Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 7 Aug 2013 14:26:29 +0000 Subject: 2013-08-07 Paolo Carlini * include/ext/atomicity.h: Add #pragma GCC system_header. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201568 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/ext/atomicity.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2bc9beed97e..460f20e4745 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2013-08-07 Paolo Carlini + + * include/ext/atomicity.h: Add #pragma GCC system_header. + 2013-08-07 Paolo Carlini PR libstdc++/58098 diff --git a/libstdc++-v3/include/ext/atomicity.h b/libstdc++-v3/include/ext/atomicity.h index 6367026c0ed..a43962724a6 100644 --- a/libstdc++-v3/include/ext/atomicity.h +++ b/libstdc++-v3/include/ext/atomicity.h @@ -29,6 +29,8 @@ #ifndef _GLIBCXX_ATOMICITY_H #define _GLIBCXX_ATOMICITY_H 1 +#pragma GCC system_header + #include #include #include -- cgit v1.2.3 From 81c749f8142ca48376c317ca941a9cff0992ac25 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 7 Aug 2013 19:00:55 +0000 Subject: compiler: Fix "missing return" error for case T1, T2 in type switches. Also change the "missing return" text and report it at the end of the function, rather than the start, to match the gc compiler. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201578 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 3 ++- gcc/go/gofrontend/statements.cc | 10 ++++++++++ gcc/testsuite/go.test/test/fixedbugs/bug086.go | 4 ++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 0b69d5d9887..4e5bd447831 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3133,7 +3133,8 @@ Check_return_statements_traverse::function(Named_object* no) return TRAVERSE_CONTINUE; if (func->block()->may_fall_through()) - error_at(func->location(), "control reaches end of non-void function"); + error_at(func->block()->end_location(), + "missing return at end of function"); return TRAVERSE_CONTINUE; } diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index ca1ad07af6c..7314918a9a1 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -4093,6 +4093,16 @@ Type_case_clauses::Type_case_clause::lower(Type* switch_val_type, bool Type_case_clauses::Type_case_clause::may_fall_through() const { + if (this->is_fallthrough_) + { + // This case means that we automatically fall through to the + // next case (it's used for T1 in case T1, T2:). It does not + // mean that we fall through to the end of the type switch as a + // whole. There is sure to be a next case and that next case + // will determine whether we fall through to the statements + // after the type switch. + return false; + } if (this->statements_ == NULL) return true; return this->statements_->may_fall_through(); diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug086.go b/gcc/testsuite/go.test/test/fixedbugs/bug086.go index fc69e0e3fc7..40d23620669 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/bug086.go +++ b/gcc/testsuite/go.test/test/fixedbugs/bug086.go @@ -6,12 +6,12 @@ package main -func f() int { // ERROR "return|control" +func f() int { if false { return 0; } // we should not be able to return successfully w/o a return statement -} +} // ERROR "return" func main() { print(f(), "\n"); -- cgit v1.2.3 From f715614228276b0f2ae231f5fabf3ee91250b34a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 8 Aug 2013 00:16:59 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201587 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 44f197d44ee..e4ce020a3eb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130807 +20130808 -- cgit v1.2.3 From 268501d1de3c239882100ac09d890bdba84d704f Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 8 Aug 2013 16:53:58 +0000 Subject: 2013-08-08 Kyrylo Tkachov Backport from mainline: 2013-08-08 Kyrylo Tkachov * config/arm/neon.md (movmisalign): Disable when we don't allow unaligned accesses. (*movmisalign_neon_store): Likewise. (*movmisalign_neon_load): Likewise. (*movmisalign_neon_store): Likewise. (*movmisalign_neon_load): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201605 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/config/arm/neon.md | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6cd85609ba5..e2aabe6b249 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-08-08 Kyrylo Tkachov + + Backport from mainline: + 2013-08-08 Kyrylo Tkachov + + * config/arm/neon.md (movmisalign): Disable when we + don't allow unaligned accesses. + (*movmisalign_neon_store): Likewise. + (*movmisalign_neon_load): Likewise. + (*movmisalign_neon_store): Likewise. + (*movmisalign_neon_load): Likewise. + 2013-08-06 Martin Jambor PR middle-end/58041 diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 99fb5e89f41..d8d420208ad 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -244,7 +244,7 @@ [(set (match_operand:VDQX 0 "neon_struct_or_register_operand") (unspec:VDQX [(match_operand:VDQX 1 "neon_struct_or_register_operand")] UNSPEC_MISALIGNED_ACCESS))] - "TARGET_NEON && !BYTES_BIG_ENDIAN" + "TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" { /* This pattern is not permitted to fail during expansion: if both arguments are non-registers (e.g. memory := constant, which can be created by the @@ -258,7 +258,7 @@ [(set (match_operand:VDX 0 "neon_struct_operand" "=Um") (unspec:VDX [(match_operand:VDX 1 "s_register_operand" " w")] UNSPEC_MISALIGNED_ACCESS))] - "TARGET_NEON && !BYTES_BIG_ENDIAN" + "TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" "vst1.\t{%P1}, %A0" [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")]) @@ -266,7 +266,7 @@ [(set (match_operand:VDX 0 "s_register_operand" "=w") (unspec:VDX [(match_operand:VDX 1 "neon_struct_operand" " Um")] UNSPEC_MISALIGNED_ACCESS))] - "TARGET_NEON && !BYTES_BIG_ENDIAN" + "TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" "vld1.\t{%P0}, %A1" [(set_attr "neon_type" "neon_vld1_1_2_regs")]) @@ -274,7 +274,7 @@ [(set (match_operand:VQX 0 "neon_struct_operand" "=Um") (unspec:VQX [(match_operand:VQX 1 "s_register_operand" " w")] UNSPEC_MISALIGNED_ACCESS))] - "TARGET_NEON && !BYTES_BIG_ENDIAN" + "TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" "vst1.\t{%q1}, %A0" [(set_attr "neon_type" "neon_vst1_1_2_regs_vst2_2_regs")]) @@ -282,7 +282,7 @@ [(set (match_operand:VQX 0 "s_register_operand" "=w") (unspec:VQX [(match_operand:VQX 1 "neon_struct_operand" " Um")] UNSPEC_MISALIGNED_ACCESS))] - "TARGET_NEON && !BYTES_BIG_ENDIAN" + "TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access" "vld1.\t{%q0}, %A1" [(set_attr "neon_type" "neon_vld1_1_2_regs")]) -- cgit v1.2.3 From 2e7591a7541babe3e9a0ab69f11dfa74d54e679b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 9 Aug 2013 00:16:42 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201613 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e4ce020a3eb..83a264ac0ee 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130808 +20130809 -- cgit v1.2.3 From 8b3a9630c13c18a8c1a372ca314b29fc91ecda12 Mon Sep 17 00:00:00 2001 From: Zhenqiang Chen Date: Fri, 9 Aug 2013 06:59:01 +0000 Subject: gcc/ChangeLog: Backport from mainline: 2013-08-09 Zhenqiang Chen * config/arm/neon.md (vcond): Fix floating-point vector comparisons against 0. gcc/testsuite/ChangeLog: Backport from mainline: 2013-08-09 Zhenqiang Chen * gcc.target/arm/lp1189445.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201620 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/arm/neon.md | 34 +++++++++++++++++++++++++++----- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/arm/lp1189445.c | 18 +++++++++++++++++ 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/lp1189445.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2aabe6b249..9eeb8ba5531 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-08-09 Zhenqiang Chen + + Backport from mainline: + 2013-08-09 Zhenqiang Chen + + * config/arm/neon.md (vcond): Fix floating-point vector + comparisons against 0. + 2013-08-08 Kyrylo Tkachov Backport from mainline: diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index d8d420208ad..86a5932d7b0 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -1732,6 +1732,7 @@ ? 3 : 1; rtx magic_rtx = GEN_INT (magic_word); int inverse = 0; + int use_zero_form = 0; int swap_bsl_operands = 0; rtx mask = gen_reg_rtx (mode); rtx tmp = gen_reg_rtx (mode); @@ -1742,12 +1743,16 @@ switch (GET_CODE (operands[3])) { case GE: + case GT: case LE: + case LT: case EQ: - if (!REG_P (operands[5]) - && (operands[5] != CONST0_RTX (mode))) - operands[5] = force_reg (mode, operands[5]); - break; + if (operands[5] == CONST0_RTX (mode)) + { + use_zero_form = 1; + break; + } + /* Fall through. */ default: if (!REG_P (operands[5])) operands[5] = force_reg (mode, operands[5]); @@ -1798,7 +1803,26 @@ a GT b -> a GT b a LE b -> b GE a a LT b -> b GT a - a EQ b -> a EQ b */ + a EQ b -> a EQ b + Note that there also exist direct comparison against 0 forms, + so catch those as a special case. */ + if (use_zero_form) + { + inverse = 0; + switch (GET_CODE (operands[3])) + { + case LT: + base_comparison = gen_neon_vclt; + break; + case LE: + base_comparison = gen_neon_vcle; + break; + default: + /* Do nothing, other zero form cases already have the correct + base_comparison. */ + break; + } + } if (!inverse) emit_insn (base_comparison (mask, operands[4], operands[5], magic_rtx)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2ae433c9ff1..55cd2e41599 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-08-09 Zhenqiang Chen + + Backport from mainline: + 2013-08-09 Zhenqiang Chen + + * gcc.target/arm/lp1189445.c: New testcase. + 2013-08-06 Martin Jambor Bernd Edlinger diff --git a/gcc/testsuite/gcc.target/arm/lp1189445.c b/gcc/testsuite/gcc.target/arm/lp1189445.c new file mode 100644 index 00000000000..766748e5509 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/lp1189445.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon } */ +/* { dg-add-options arm_neon } */ +/* { dg-options "-O3" } */ + +int id; +int +test (const long int *data) +{ + int i, retval; + retval = id; + for (i = 0; i < id; i++) + { + retval &= (data[i] <= 0); + } + + return (retval); +} -- cgit v1.2.3 From bb2e027f42e6f72df97a35c496ae492e0eae03a1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 9 Aug 2013 10:53:01 +0000 Subject: * c-ada-spec.c (print_ada_declaration): Prevent accessing null asm name git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201626 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 4 ++++ gcc/c-family/c-ada-spec.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 3acbfe39292..dd917ae1cca 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2013-08-09 Arnaud Charlet + + * c-ada-spec.c (print_ada_declaration): Prevent accessing null asm name + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 21cbfe94fba..2d6ce14ca48 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2900,7 +2900,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, pp_string (buffer, " -- "); dump_sloc (buffer, t); - if (is_abstract) + if (is_abstract || !DECL_ASSEMBLER_NAME (t)) return 1; newline_and_indent (buffer, spc); -- cgit v1.2.3 From 2320478a6e6e1266bc2e0d80ee6f61da281d3eb5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 9 Aug 2013 20:52:50 +0000 Subject: net: give C.getaddrinfo a hint that we only want SOCK_STREAM answers This should be more efficient everywhere, and appears to be required on Solaris. Copied from master repository. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201638 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/net/cgo_unix.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libgo/go/net/cgo_unix.go b/libgo/go/net/cgo_unix.go index a4d96a86d12..ce54d827c8e 100644 --- a/libgo/go/net/cgo_unix.go +++ b/libgo/go/net/cgo_unix.go @@ -103,6 +103,7 @@ func cgoLookupIPCNAME(name string) (addrs []IP, cname string, err error, complet var hints syscall.Addrinfo hints.Ai_flags = int32(cgoAddrInfoFlags()) + hints.Ai_socktype = syscall.SOCK_STREAM h := syscall.StringBytePtr(name) syscall.Entersyscall() @@ -130,7 +131,7 @@ func cgoLookupIPCNAME(name string) (addrs []IP, cname string, err error, complet } } for r := res; r != nil; r = r.Ai_next { - // Everything comes back twice, once for UDP and once for TCP. + // We only asked for SOCK_STREAM, but check anyhow. if r.Ai_socktype != syscall.SOCK_STREAM { continue } -- cgit v1.2.3 From a68f25c5a5b00b82116336515a51cea39d249d5a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 10 Aug 2013 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201642 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 83a264ac0ee..c95a385e1d5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130809 +20130810 -- cgit v1.2.3 From 0bc050b958fc5fc0c9c9db630b943003c904360b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 11 Aug 2013 00:16:25 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201650 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c95a385e1d5..57cbe898858 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130810 +20130811 -- cgit v1.2.3 From e50adc20a5aff018aadd7666b6611445e3077fae Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sun, 11 Aug 2013 11:31:41 +0000 Subject: 2013-08-11 Janus Weil Backport from trunk: 2013-08-09 Janus Weil PR fortran/58058 * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Free the temporary string, if necessary. 2013-08-11 Janus Weil Backport from trunk: 2013-08-09 Janus Weil PR fortran/58058 * gfortran.dg/transfer_intrinsic_6.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201652 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/trans-intrinsic.c | 10 ++++++++-- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/transfer_intrinsic_6.f90 | 20 ++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/transfer_intrinsic_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9a8b794bc57..be2afaa869d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2013-08-11 Janus Weil + + Backport from trunk: + 2013-08-09 Janus Weil + + PR fortran/58058 + * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Free the temporary + string, if necessary. + 2013-07-28 Tobias Burnus Backport from mainline diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index a2bb2a78ee7..ddd9eaea5c2 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -5653,8 +5653,7 @@ scalar_transfer: if (expr->ts.type == BT_CHARACTER) { - tree direct; - tree indirect; + tree direct, indirect, free; ptr = convert (gfc_get_pchar_type (expr->ts.kind), source); tmpdecl = gfc_create_var (gfc_get_pchar_type (expr->ts.kind), @@ -5687,6 +5686,13 @@ scalar_transfer: tmp = build3_v (COND_EXPR, tmp, direct, indirect); gfc_add_expr_to_block (&se->pre, tmp); + /* Free the temporary string, if necessary. */ + free = gfc_call_free (tmpdecl); + tmp = fold_build2_loc (input_location, GT_EXPR, boolean_type_node, + dest_word_len, source_bytes); + tmp = build3_v (COND_EXPR, tmp, free, build_empty_stmt (input_location)); + gfc_add_expr_to_block (&se->post, tmp); + se->expr = tmpdecl; se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55cd2e41599..16f499fc185 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-11 Janus Weil + + Backport from trunk: + 2013-08-09 Janus Weil + + PR fortran/58058 + * gfortran.dg/transfer_intrinsic_6.f90: New. + 2013-08-09 Zhenqiang Chen Backport from mainline: diff --git a/gcc/testsuite/gfortran.dg/transfer_intrinsic_6.f90 b/gcc/testsuite/gfortran.dg/transfer_intrinsic_6.f90 new file mode 100644 index 00000000000..e76bc49aeda --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transfer_intrinsic_6.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! PR 58058: [4.7/4.8/4.9 Regression] Memory leak with transfer function +! +! Contributed by Thomas Jourdan + + implicit none + + integer, dimension(3) :: t1 + character(len=64) :: str + + t1 = (/1,2,3/) + + str = transfer(t1,str) + +end + +! { dg-final { scan-tree-dump-times "__builtin_free" 1 "original" } } +! { dg-final { cleanup-tree-dump "original" } } -- cgit v1.2.3 From 82ba65c0acc151f27b53df5f968faac464e70043 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 12 Aug 2013 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201656 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 57cbe898858..3047425abcc 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130811 +20130812 -- cgit v1.2.3 From 50971947c41f06ab39f9b43c2d2e9da88c053c03 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 13 Aug 2013 00:16:22 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201677 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3047425abcc..524267245e1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130812 +20130813 -- cgit v1.2.3 From 1e16db518345d9db59c5ecf4182f62227b3fa134 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 13 Aug 2013 12:45:06 +0000 Subject: 2013-08-13 Uros Bizjak Backport from mainline 2013-08-12 Perez Read PR target/58132 * config/i386/i386.md (*movabs_1): Add PTR before operand 0 for intel asm alternative. (*movabs_2): Ditto for operand 1. testsuite/ChangeLog: 2013-08-13 Uros Bizjak Backport from mainline 2013-08-12 Perez Read PR target/58132 * gcc.target/i386/movabs-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201684 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 19 ++++++++++++++----- gcc/config/i386/i386.md | 4 ++-- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/movabs-1.c | 10 ++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/movabs-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9eeb8ba5531..5260af02664 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-08-13 Uros Bizjak + + Backport from mainline + 2013-08-12 Perez Read + + PR target/58132 + * config/i386/i386.md (*movabs_1): Add PTR before + operand 0 for intel asm alternative. + (*movabs_2): Ditto for operand 1. + 2013-08-09 Zhenqiang Chen Backport from mainline: @@ -63,8 +73,7 @@ (s390_expand_builtin): New function. (TARGET_INIT_BUILTINS): Define. (TARGET_EXPAND_BUILTIN): Define. - * common/config/s390/s390-common.c (processor_flags_table): Add - PF_TX. + * common/config/s390/s390-common.c (processor_flags_table): Add PF_TX. * config/s390/predicates.md (s390_comparison): Handle CCRAWmode. (s390_alc_comparison): Likewise. * config/s390/s390-modes.def: Add CCRAWmode. @@ -105,7 +114,7 @@ 2013-08-01 Ganesh Gopalasubramanian Backport from mainline - 2013-05-13 Ganesh Gopalasubramanian + 2013-05-13 Ganesh Gopalasubramanian * config/i386/i386.c (processor_target_table): Modified default @@ -162,7 +171,7 @@ (ix86_save_reg): If the function contains a nonlocal label, save the PIC base reg. * config/darwin-protos.h (machopic_should_output_picbase_label): New. - * gcc/config/darwin.c (emitted_pic_label_num): New GTY. + * gcc/config/darwin.c (emitted_pic_label_num): New GTY. (update_pic_label_number_if_needed): New. (machopic_output_function_base_name): Adjust for nonlocal receiver case. @@ -244,7 +253,7 @@ 2013-07-10 Georg-Johann Lay Backport from 2013-07-10 trunk r200870. - + PR target/57506 * config/avr/avr-mcus.def (atmega16hva, atmega16hva2, atmega16hvb) (atmega16m1, atmega16u4, atmega32a, atmega32c1, atmega32hvb) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 57e0dcacdc0..4d5b2872d09 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2316,7 +2316,7 @@ "TARGET_LP64 && ix86_check_movabs (insn, 0)" "@ movabs{}\t{%1, %P0|[%P0], %1} - mov{}\t{%1, %a0|%a0, %1}" + mov{}\t{%1, %a0| PTR %a0, %1}" [(set_attr "type" "imov") (set_attr "modrm" "0,*") (set_attr "length_address" "8,0") @@ -2330,7 +2330,7 @@ "TARGET_LP64 && ix86_check_movabs (insn, 1)" "@ movabs{}\t{%P1, %0|%0, [%P1]} - mov{}\t{%a1, %0|%0, %a1}" + mov{}\t{%a1, %0|%0, PTR %a1}" [(set_attr "type" "imov") (set_attr "modrm" "0,*") (set_attr "length_address" "8,0") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 16f499fc185..552636692a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-13 Uros Bizjak + + Backport from mainline + 2013-08-12 Perez Read + + PR target/58132 + * gcc.target/i386/movabs-1.c: New test. + 2013-08-11 Janus Weil Backport from trunk: diff --git a/gcc/testsuite/gcc.target/i386/movabs-1.c b/gcc/testsuite/gcc.target/i386/movabs-1.c new file mode 100644 index 00000000000..75ef8d2a6cb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/movabs-1.c @@ -0,0 +1,10 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -masm=intel" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target masm_intel } */ + +void +foo (void) +{ + *(volatile long*)0xFFFF800000000000 = -1; +} -- cgit v1.2.3 From a4fcbac3da75401c3d365002c1cf240e20421d35 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 13 Aug 2013 13:22:18 +0000 Subject: 2013-08-12 Andrew Haley Backport from mainline: * 2013-07-11 Andreas Schwab * config/aarch64/aarch64-linux.h (CPP_SPEC): Define. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/aarch64/aarch64-linux.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5260af02664..647835cd07f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-12 Andrew Haley + + Backport from mainline: + * 2013-07-11 Andreas Schwab + + * config/aarch64/aarch64-linux.h (CPP_SPEC): Define. + 2013-08-13 Uros Bizjak Backport from mainline diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index e914ed27f1f..83efad447f1 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -23,6 +23,8 @@ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1" +#define CPP_SPEC "%{pthread:-D_REENTRANT}" + #define LINUX_TARGET_LINK_SPEC "%{h*} \ %{static:-Bstatic} \ %{shared:-shared} \ -- cgit v1.2.3 From 5bfe8ab01d4150ef0b8fbd35867458d3b22ad6a8 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 13 Aug 2013 13:34:08 +0000 Subject: 2013-08-13 Marek Polacek Jakub Jelinek PR tree-optimization/57980 * tree-tailcall.c (process_assignment): Return false when not dealing with integers or floats. * gcc.dg/pr57980.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr57980.c | 19 +++++++++++++++++++ gcc/tree-tailcall.c | 8 ++++++-- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr57980.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 647835cd07f..7b987b326fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-13 Marek Polacek + Jakub Jelinek + + PR tree-optimization/57980 + * tree-tailcall.c (process_assignment): Return false + when not dealing with integers or floats. + 2013-08-12 Andrew Haley Backport from mainline: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 552636692a7..55fd03d11c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Marek Polacek + + PR tree-optimization/57980 + * gcc.dg/pr57980.c: New test. + 2013-08-13 Uros Bizjak Backport from mainline diff --git a/gcc/testsuite/gcc.dg/pr57980.c b/gcc/testsuite/gcc.dg/pr57980.c new file mode 100644 index 00000000000..be83536c5f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr57980.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/57980 */ +/* { dg-do compile } */ +/* { dg-options "-O -foptimize-sibling-calls -w" } */ + +typedef int V __attribute__ ((vector_size (2 * sizeof (int)))); +extern V f (void); + +V +bar (void) +{ + return -f (); +} + +V +foo (void) +{ + V v = { }; + return v - f (); +} diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index c6581dcedcd..350d707b235 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -328,8 +328,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, case NEGATE_EXPR: if (FLOAT_TYPE_P (TREE_TYPE (op0))) *m = build_real (TREE_TYPE (op0), dconstm1); - else + else if (INTEGRAL_TYPE_P (TREE_TYPE (op0))) *m = build_int_cst (TREE_TYPE (op0), -1); + else + return false; *ass_var = dest; return true; @@ -341,8 +343,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m, { if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var))) *m = build_real (TREE_TYPE (non_ass_var), dconstm1); - else + else if (INTEGRAL_TYPE_P (TREE_TYPE (non_ass_var))) *m = build_int_cst (TREE_TYPE (non_ass_var), -1); + else + return false; *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var); } -- cgit v1.2.3 From 15d51aaf88fc23c77ad024b87a8894ab6914e3b9 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 13 Aug 2013 15:59:03 +0000 Subject: * gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for values outside of the range of the type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201693 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gnat.dg/loop_optimization16.adb | 24 +++++++++++++++++++++++ gcc/testsuite/gnat.dg/loop_optimization16_pkg.adb | 8 ++++++++ gcc/testsuite/gnat.dg/loop_optimization16_pkg.ads | 7 +++++++ 6 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/loop_optimization16.adb create mode 100644 gcc/testsuite/gnat.dg/loop_optimization16_pkg.adb create mode 100644 gcc/testsuite/gnat.dg/loop_optimization16_pkg.ads diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index bdb70ddb8c0..edecddf9118 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Eric Botcazou + + * gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for + values outside of the range of the type. + 2013-06-13 Eric Botcazou * gcc-interface/ada-tree.h (DECL_BY_DOUBLE_REF_P): Delete. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index cd78bf33a37..256827dbe16 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -2267,7 +2267,10 @@ can_equal_min_or_max_val_p (tree val, tree type, bool max) if (TREE_CODE (val) != INTEGER_CST) return true; - return tree_int_cst_equal (val, min_or_max_val) == 1; + if (max) + return tree_int_cst_lt (val, min_or_max_val) == 0; + else + return tree_int_cst_lt (min_or_max_val, val) == 0; } /* Return true if VAL (of type TYPE) can equal the minimum value of TYPE. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55fd03d11c2..2da6d123c5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Eric Botcazou + + * gnat.dg/loop_optimization16.adb: New test. + * gnat.dg/loop_optimization16_pkg.ad[sb]: New helper. + 2013-08-13 Marek Polacek PR tree-optimization/57980 diff --git a/gcc/testsuite/gnat.dg/loop_optimization16.adb b/gcc/testsuite/gnat.dg/loop_optimization16.adb new file mode 100644 index 00000000000..b9f2b70bb45 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization16.adb @@ -0,0 +1,24 @@ +-- { dg-do run } + +with Loop_Optimization16_Pkg; use Loop_Optimization16_Pkg; + +procedure Loop_Optimization16 is + + Counter : Natural := 0; + + C : constant Natural := F; + + subtype Index_T is Index_Base range 1 .. Index_Base (C); + +begin + + for I in Index_T'First .. Index_T'Last loop + Counter := Counter + 1; + exit when Counter > 200; + end loop; + + if Counter > 200 then + raise Program_Error; + end if; + +end Loop_Optimization16; diff --git a/gcc/testsuite/gnat.dg/loop_optimization16_pkg.adb b/gcc/testsuite/gnat.dg/loop_optimization16_pkg.adb new file mode 100644 index 00000000000..e4142f6e6a1 --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization16_pkg.adb @@ -0,0 +1,8 @@ +package body Loop_Optimization16_Pkg is + + function F return Natural is + begin + return Natural (Index_Base'Last); + end; + +end Loop_Optimization16_Pkg; diff --git a/gcc/testsuite/gnat.dg/loop_optimization16_pkg.ads b/gcc/testsuite/gnat.dg/loop_optimization16_pkg.ads new file mode 100644 index 00000000000..abeecfb646f --- /dev/null +++ b/gcc/testsuite/gnat.dg/loop_optimization16_pkg.ads @@ -0,0 +1,7 @@ +package Loop_Optimization16_Pkg is + + type Index_Base is range 0 .. 127; + + function F return Natural; + +end Loop_Optimization16_Pkg; -- cgit v1.2.3 From 626bf7c23d563876f7176be3afcfce15b57b4af1 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Tue, 13 Aug 2013 16:40:33 +0000 Subject: 2013-08-13 Vladimir Makarov Backport from mainline 2013-06-06 Vladimir Makarov PR rtl-optimization/57459 * lra-constraints.c (update_ebb_live_info): Fix typo for operand type when setting live regs. 2013-08-13 Vladimir Makarov Backport from mainline 2013-06-06 Vladimir Makarov PR rtl-optimization/57459 * gcc.target/i386/pr57459.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201695 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++ gcc/lra-constraints.c | 2 +- gcc/testsuite/ChangeLog | 12 +++++-- gcc/testsuite/gcc.target/i386/pr57459.c | 60 +++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr57459.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b987b326fe..42a5e1b420e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-13 Vladimir Makarov + + Backport from mainline + 2013-06-06 Vladimir Makarov + + PR rtl-optimization/57459 + * lra-constraints.c (update_ebb_live_info): Fix typo for operand + type when setting live regs. + 2013-08-13 Marek Polacek Jakub Jelinek diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index dfbe93a8037..2d8aa810eb9 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4396,7 +4396,7 @@ update_ebb_live_info (rtx head, rtx tail) bitmap_clear_bit (&live_regs, reg->regno); /* Mark each used value as live. */ for (reg = curr_id->regs; reg != NULL; reg = reg->next) - if (reg->type == OP_IN + if (reg->type != OP_OUT && bitmap_bit_p (&check_only_regs, reg->regno)) bitmap_set_bit (&live_regs, reg->regno); /* It is quite important to remove dead move insns because it diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2da6d123c5a..fe8c5736da7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-13 Vladimir Makarov + + Backport from mainline + 2013-06-06 Vladimir Makarov + + PR rtl-optimization/57459 + * gcc.target/i386/pr57459.c: New test. + 2013-08-13 Eric Botcazou * gnat.dg/loop_optimization16.adb: New test. @@ -13,8 +21,8 @@ Backport from mainline 2013-08-12 Perez Read - PR target/58132 - * gcc.target/i386/movabs-1.c: New test. + PR target/58132 + * gcc.target/i386/movabs-1.c: New test. 2013-08-11 Janus Weil diff --git a/gcc/testsuite/gcc.target/i386/pr57459.c b/gcc/testsuite/gcc.target/i386/pr57459.c new file mode 100644 index 00000000000..75101145afc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr57459.c @@ -0,0 +1,60 @@ +/* PR rtl-optimization/57459 */ +/* { dg-do run } */ +/* { dg-options "-fno-inline -O2 -minline-all-stringops -fno-omit-frame-pointer" } */ + +int total1[10], total2[10], total3[10], total4[10], total5[10], a[20]; +int len; + +void stackclean() { + void *ptr = __builtin_alloca(20000); + __builtin_memset(ptr, 0, 20000); +} + +void foo(const char *s) { + int r1 = a[1]; + int r2 = a[2]; + int r3 = a[3]; + int r4 = a[4]; + int r5 = a[5]; + + len = __builtin_strlen(s); + + if (s != 0) + return; + + while (r1) { + total1[r1] = r1; + r1--; + } + + while (r2) { + total2[r2] = r2; + r2--; + } + + while (r3) { + total3[r3] = r3; + r3--; + } + + while (r4) { + total4[r4] = r4; + r4--; + } + + while (r5) { + total5[r5] = r5; + r5--; + } +} + +extern void abort (void); + +int main() { + stackclean(); + foo("abcdefgh"); + if (len != 8) + abort (); + return 0; +} + -- cgit v1.2.3 From a5a64365cbc9b8dc202eb4d74cdc75eafc45c149 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Aug 2013 17:02:13 +0000 Subject: PR sanitizer/56417 * asan.c (instrument_strlen_call): Fix typo in comment. Use char * type even for the lhs of POINTER_PLUS_EXPR. * gcc.dg/asan/pr56417.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201697 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/asan.c | 9 ++++----- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/asan/pr56417.c | 9 +++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/asan/pr56417.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 42a5e1b420e..b48e0a4084f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-13 Jakub Jelinek + + PR sanitizer/56417 + * asan.c (instrument_strlen_call): Fix typo in comment. + Use char * type even for the lhs of POINTER_PLUS_EXPR. + 2013-08-13 Vladimir Makarov Backport from mainline diff --git a/gcc/asan.c b/gcc/asan.c index 52a2dbc5dfd..d68579b2e5e 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1675,7 +1675,7 @@ instrument_mem_region_access (tree base, tree len, access to the last byte of the argument; it uses the result of the call to deduce the offset of that last byte. - Upon completion, iff the call has actullay been instrumented, this + Upon completion, iff the call has actually been instrumented, this function returns TRUE and *ITER points to the statement logically following the built-in strlen function call *ITER was initially pointing to. Otherwise, the function returns FALSE and *ITER @@ -1706,10 +1706,10 @@ instrument_strlen_call (gimple_stmt_iterator *iter) /* Instrument the access to the first byte of str_arg. i.e: _1 = str_arg; instrument (_1); */ + tree cptr_type = build_pointer_type (char_type_node); gimple str_arg_ssa = gimple_build_assign_with_ops (NOP_EXPR, - make_ssa_name (build_pointer_type - (char_type_node), NULL), + make_ssa_name (cptr_type, NULL), str_arg, NULL); gimple_set_location (str_arg_ssa, loc); gimple_stmt_iterator gsi = *iter; @@ -1728,8 +1728,7 @@ instrument_strlen_call (gimple_stmt_iterator *iter) pointer_plus expr: (_1 + len). */ gimple stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, - make_ssa_name (TREE_TYPE (str_arg), - NULL), + make_ssa_name (cptr_type, NULL), gimple_assign_lhs (str_arg_ssa), len); gimple_set_location (stmt, loc); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe8c5736da7..a305735aa24 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Jakub Jelinek + + PR sanitizer/56417 + * gcc.dg/asan/pr56417.c: New test. + 2013-08-13 Vladimir Makarov Backport from mainline diff --git a/gcc/testsuite/gcc.dg/asan/pr56417.c b/gcc/testsuite/gcc.dg/asan/pr56417.c new file mode 100644 index 00000000000..b7eabf125aa --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr56417.c @@ -0,0 +1,9 @@ +/* PR sanitizer/56417 */ +/* { dg-do compile } */ +/* { dg-options "-w" } */ + +int +foo (void) +{ + return __builtin_strlen (&foo); +} -- cgit v1.2.3 From 9b2c7f7bf76ade99411ff20e852fe9c07951ed41 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 14 Aug 2013 00:16:42 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201716 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 524267245e1..6c3731088a1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130813 +20130814 -- cgit v1.2.3 From 6dd8a8ea93f035f571060ac04f4e65cc3c02e6ac Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 14 Aug 2013 09:29:22 +0000 Subject: PR target/58067 * config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle there also UNSPEC_PLTOFF. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201721 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.c | 40 +++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b48e0a4084f..281e90741ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-08-14 Jakub Jelinek + Alexandre Oliva + + PR target/58067 + * config/i386/i386.c (ix86_delegitimize_address): For CM_MEDIUM_PIC + and CM_LARGE_PIC ix86_cmodel fall thru into the -m32 code, handle + there also UNSPEC_PLTOFF. + 2013-08-13 Jakub Jelinek PR sanitizer/56417 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5dab4f04abc..19e955f9392 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13598,21 +13598,29 @@ ix86_delegitimize_address (rtx x) x = replace_equiv_address_nv (orig_x, x); return x; } - if (GET_CODE (x) != CONST - || GET_CODE (XEXP (x, 0)) != UNSPEC - || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL - && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL) - || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)) - return ix86_delegitimize_tls_address (orig_x); - x = XVECEXP (XEXP (x, 0), 0, 0); - if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x)) + + if (GET_CODE (x) == CONST + && GET_CODE (XEXP (x, 0)) == UNSPEC + && (XINT (XEXP (x, 0), 1) == UNSPEC_GOTPCREL + || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL) + && (MEM_P (orig_x) || XINT (XEXP (x, 0), 1) == UNSPEC_PCREL)) { - x = simplify_gen_subreg (GET_MODE (orig_x), x, - GET_MODE (x), 0); - if (x == NULL_RTX) - return orig_x; + x = XVECEXP (XEXP (x, 0), 0, 0); + if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x)) + { + x = simplify_gen_subreg (GET_MODE (orig_x), x, + GET_MODE (x), 0); + if (x == NULL_RTX) + return orig_x; + } + return x; } - return x; + + if (ix86_cmodel != CM_MEDIUM_PIC && ix86_cmodel != CM_LARGE_PIC) + return ix86_delegitimize_tls_address (orig_x); + + /* Fall thru into the code shared with -m32 for -mcmodel=large -fpic + and -mcmodel=medium -fpic. */ } if (GET_CODE (x) != PLUS @@ -13649,10 +13657,12 @@ ix86_delegitimize_address (rtx x) if (GET_CODE (x) == UNSPEC && ((XINT (x, 1) == UNSPEC_GOT && MEM_P (orig_x) && !addend) - || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x)))) + || (XINT (x, 1) == UNSPEC_GOTOFF && !MEM_P (orig_x)) + || (XINT (x, 1) == UNSPEC_PLTOFF && ix86_cmodel == CM_LARGE_PIC + && !MEM_P (orig_x) && !addend))) result = XVECEXP (x, 0, 0); - if (TARGET_MACHO && darwin_local_data_pic (x) + if (!TARGET_64BIT && TARGET_MACHO && darwin_local_data_pic (x) && !MEM_P (orig_x)) result = XVECEXP (x, 0, 0); -- cgit v1.2.3 From 68e94167d3cffe4a58b485d8375af011002185b8 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 14 Aug 2013 14:09:59 +0000 Subject: Backport from mainline 2013-08-13 Uros Bizjak * config/i386/sse.md (*sse2_maskmovdqu): Emit addr32 prefix when Pmode != word_mode. Add length_address attribute. (sse3_monitor_): Merge from sse3_monitor and sse3_monitor64_ insn patterns. Emit addr32 prefix when Pmode != word_mode. Update insn length attribute. * config/i386/i386.c (ix86_option_override_internal): Update ix86_gen_monitor selection for merged sse3_monitor insn. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201726 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 13 +++++++++++++ gcc/config/i386/i386.c | 9 +++------ gcc/config/i386/sse.md | 28 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 281e90741ec..999cb22e58d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2013-08-14 Uros Bizjak + + Backport from mainline + 2013-08-13 Uros Bizjak + + * config/i386/sse.md (*sse2_maskmovdqu): Emit addr32 prefix + when Pmode != word_mode. Add length_address attribute. + (sse3_monitor_): Merge from sse3_monitor and + sse3_monitor64_ insn patterns. Emit addr32 prefix when + Pmode != word_mode. Update insn length attribute. + * config/i386/i386.c (ix86_option_override_internal): Update + ix86_gen_monitor selection for merged sse3_monitor insn. + 2013-08-14 Jakub Jelinek Alexandre Oliva diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 19e955f9392..35cf1ef4a17 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3768,24 +3768,19 @@ ix86_option_override_internal (bool main_args_p) ix86_gen_leave = gen_leave_rex64; if (Pmode == DImode) { - ix86_gen_monitor = gen_sse3_monitor64_di; ix86_gen_tls_global_dynamic_64 = gen_tls_global_dynamic_64_di; ix86_gen_tls_local_dynamic_base_64 = gen_tls_local_dynamic_base_64_di; } else { - ix86_gen_monitor = gen_sse3_monitor64_si; ix86_gen_tls_global_dynamic_64 = gen_tls_global_dynamic_64_si; ix86_gen_tls_local_dynamic_base_64 = gen_tls_local_dynamic_base_64_si; } } else - { - ix86_gen_leave = gen_leave; - ix86_gen_monitor = gen_sse3_monitor; - } + ix86_gen_leave = gen_leave; if (Pmode == DImode) { @@ -3797,6 +3792,7 @@ ix86_option_override_internal (bool main_args_p) ix86_gen_allocate_stack_worker = gen_allocate_stack_worker_probe_di; ix86_gen_adjust_stack_and_probe = gen_adjust_stack_and_probedi; ix86_gen_probe_stack_range = gen_probe_stack_rangedi; + ix86_gen_monitor = gen_sse3_monitor_di; } else { @@ -3808,6 +3804,7 @@ ix86_option_override_internal (bool main_args_p) ix86_gen_allocate_stack_worker = gen_allocate_stack_worker_probe_si; ix86_gen_adjust_stack_and_probe = gen_adjust_stack_and_probesi; ix86_gen_probe_stack_range = gen_probe_stack_rangesi; + ix86_gen_monitor = gen_sse3_monitor_si; } #ifdef USE_IX86_CLD diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 4f9bd658e2d..05cf7f9a05e 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -7758,9 +7758,17 @@ (mem:V16QI (match_dup 0))] UNSPEC_MASKMOV))] "TARGET_SSE2" - "%vmaskmovdqu\t{%2, %1|%1, %2}" +{ + /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing + that requires %v to be at the beginning of the opcode name. */ + if (Pmode != word_mode) + fputs ("\taddr32", asm_out_file); + return "%vmaskmovdqu\t{%2, %1|%1, %2}"; +} [(set_attr "type" "ssemov") (set_attr "prefix_data16" "1") + (set (attr "length_address") + (symbol_ref ("Pmode != word_mode"))) ;; The implicit %rdi operand confuses default length_vex computation. (set (attr "length_vex") (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))"))) @@ -7808,26 +7816,18 @@ "mwait" [(set_attr "length" "3")]) -(define_insn "sse3_monitor" - [(unspec_volatile [(match_operand:SI 0 "register_operand" "a") - (match_operand:SI 1 "register_operand" "c") - (match_operand:SI 2 "register_operand" "d")] - UNSPECV_MONITOR)] - "TARGET_SSE3 && !TARGET_64BIT" - "monitor\t%0, %1, %2" - [(set_attr "length" "3")]) - -(define_insn "sse3_monitor64_" +(define_insn "sse3_monitor_" [(unspec_volatile [(match_operand:P 0 "register_operand" "a") (match_operand:SI 1 "register_operand" "c") (match_operand:SI 2 "register_operand" "d")] UNSPECV_MONITOR)] - "TARGET_SSE3 && TARGET_64BIT" + "TARGET_SSE3" ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in ;; RCX and RDX are used. Since 32bit register operands are implicitly ;; zero extended to 64bit, we only need to set up 32bit registers. - "monitor" - [(set_attr "length" "3")]) + "%^monitor" + [(set (attr "length") + (symbol_ref ("(Pmode != word_mode) + 3")))]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -- cgit v1.2.3 From 2bc50e606e6cf45c2ac894fae8baa0eb0555393a Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 14 Aug 2013 19:04:44 +0000 Subject: 2013-08-14 Andreas Krebbel * config/s390/sjlj.S: Add file missing from last commit. * config/s390/target.h: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201745 138bc75d-0d04-0410-961f-82ee72b054a4 --- libitm/ChangeLog | 5 ++ libitm/config/s390/sjlj.S | 108 +++++++++++++++++++++++++++++++++++++ libitm/config/s390/target.h | 127 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 libitm/config/s390/sjlj.S create mode 100644 libitm/config/s390/target.h diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 4f3dce55e0a..1f6b22d345a 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,8 @@ +2013-08-14 Andreas Krebbel + + * config/s390/sjlj.S: Add file missing from last commit. + * config/s390/target.h: Likewise. + 2013-08-02 Andreas Krebbel Backports from mainline: diff --git a/libitm/config/s390/sjlj.S b/libitm/config/s390/sjlj.S new file mode 100644 index 00000000000..592d9af2cfd --- /dev/null +++ b/libitm/config/s390/sjlj.S @@ -0,0 +1,108 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Andreas Krebbel + + This file is part of the GNU Transactional Memory Library (libitm). + + Libitm is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libitm is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + + +#include "asmcfi.h" + +.text + .align 4 +.globl _ITM_beginTransaction + .type _ITM_beginTransaction, @function + + /* _ITM_beginTransaction (int props); props -> r2 */ +_ITM_beginTransaction: + cfi_startproc +#ifdef __s390x__ + lgr %r3,%r15 /* backup stack pointer */ + aghi %r15,-304 /* jump buffer (144) + reg save area (160) */ + cfi_adjust_cfa_offset(304) + stmg %r6,%r14,160(%r15) + stg %r3,72+160(%r15) /* store the old stack pointer */ + std %f8,80+160(%r15) + std %f9,88+160(%r15) + std %f10,96+160(%r15) + std %f11,104+160(%r15) + std %f12,112+160(%r15) + std %f13,120+160(%r15) + std %f14,128+160(%r15) + std %f15,136+160(%r15) + la %r3,160(%r15) /* second argument to GTM_begin_transaction */ + brasl %r14,GTM_begin_transaction + lg %r1,64+160(%r15) + aghi %r15,304 + cfi_adjust_cfa_offset(-304) + br %r1 +#else + lr %r3,%r15 /* backup stack pointer */ + ahi %r15,-152 /* jump buffer (56) + reg save area (96) */ + cfi_adjust_cfa_offset(152) + stm %r6,%r14,96(%r15) + st %r3,36+96(%r15) /* store the old stack pointer */ + std %f4,40+96(%r15) + std %f6,48+96(%r15) + la %r3,96(%r15) /* second argument to GTM_begin_transaction */ + /* begin_transaction (uint32_t prop, const gtm_jmpbuf *jb) */ + brasl %r14,GTM_begin_transaction /* requires mzarch */ + l %r1,32+96(%r15) + ahi %r15,152 + cfi_adjust_cfa_offset(-152) + br %r1 +#endif + cfi_endproc + + .size _ITM_beginTransaction, .-_ITM_beginTransaction + + .align 4 +.globl GTM_longjmp + .type GTM_longjmp, @function + .hidden GTM_longjmp + + /* uint32_t GTM_longjmp (uint32_t, const gtm_jmpbuf *, uint32_t) */ +GTM_longjmp: + /* First parameter becomes the return value of + _ITM_beginTransaction (r2). + Third parameter is ignored for now. */ + cfi_startproc +#ifdef __s390x__ + ld %f8,80(%r3) + ld %f9,88(%r3) + ld %f10,96(%r3) + ld %f11,104(%r3) + ld %f12,112(%r3) + ld %f13,120(%r3) + ld %f14,128(%r3) + ld %f15,136(%r3) + lmg %r6,%r15,0(%r3) + br %r14 +#else + ld %f4,40(%r3) + ld %f6,48(%r3) + lm %r6,%r15,0(%r3) + br %r14 +#endif + cfi_endproc + + .size GTM_longjmp, .-GTM_longjmp + + .section .note.GNU-stack, "", @progbits diff --git a/libitm/config/s390/target.h b/libitm/config/s390/target.h new file mode 100644 index 00000000000..cec49cf7774 --- /dev/null +++ b/libitm/config/s390/target.h @@ -0,0 +1,127 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Andreas Krebbel . + + This file is part of the GNU Transactional Memory Library (libitm). + + Libitm is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libitm is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifdef HAVE_SYS_AUXV_H +#include +#endif + +namespace GTM HIDDEN { + +#define HW_CACHELINE_SIZE 256 + +typedef struct gtm_jmpbuf +{ + /* We save registers r6-r14. */ + long int __gregs[9]; + /* r15 is stored into cfa field. It needs to be named that way + since tls.h is accessing the field by name. Be aware that this + is not actually what we consider the CFA on s390 (since there is + a fix offset between sp and CFA). It is merely the saved stack + pointer. */ + void *cfa; + +#ifdef __s390x__ + /* We save fpu registers f8 - f15. */ + long __fpregs[8]; +#else + /* We save fpu registers f4 and f6. */ + long __fpregs[4]; +#endif +} gtm_jmpbuf; + +static inline void +cpu_relax (void) +{ + __asm volatile ("" : : : "memory"); +} + + +// Use HTM if it is supported by the system. +// See gtm_thread::begin_transaction for how these functions are used. +#if defined (__linux__) \ + && defined (HAVE_AS_HTM) \ + && defined (HAVE_GETAUXVAL) \ + && defined (HWCAP_S390_TE) + +#include + +/* Number of retries for transient failures. */ +#define _HTM_ITM_RETRIES 10 +#define USE_HTM_FASTPATH + +static inline bool +htm_available () +{ + return (getauxval (AT_HWCAP) & HWCAP_S390_TE) ? true : false; +} + +static inline uint32_t +htm_init () +{ + return htm_available () ? _HTM_ITM_RETRIES : 0; +} + +static inline uint32_t +htm_begin () +{ + __asm volatile (".machine \"all\" \n\t"); + return __builtin_tbegin_nofloat (NULL); +} + +static inline bool +htm_begin_success (uint32_t begin_ret) +{ + return begin_ret == _HTM_TBEGIN_STARTED; +} + +static inline void +htm_commit () +{ + __asm volatile (".machine \"all\" \n\t"); + __builtin_tend (); +} + +static inline void +htm_abort () +{ + __asm volatile (".machine \"all\" \n\t"); + __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE); +} + +static inline bool +htm_abort_should_retry (uint32_t begin_ret) +{ + return begin_ret == _HTM_TBEGIN_TRANSIENT; +} + +static inline bool +htm_transaction_active () +{ + __asm volatile (".machine \"all\" \n\t"); + return __builtin_tx_nesting_depth() != 0; +} + +#endif + +} // namespace GTM -- cgit v1.2.3 From 1610b6d172f3198a4f34849ff1981ea1791bb18d Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 14 Aug 2013 19:44:27 +0000 Subject: 2013-08-14 Andreas Krebbel * config/s390/htmxlintrin.h: Add file missing from last commit. * config/s390/htmintrin.h: Likewise. * config/s390/s390intrin.h: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201746 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++ gcc/config/s390/htmintrin.h | 57 +++++++++++++ gcc/config/s390/htmxlintrin.h | 182 ++++++++++++++++++++++++++++++++++++++++++ gcc/config/s390/s390intrin.h | 33 ++++++++ 4 files changed, 278 insertions(+) create mode 100644 gcc/config/s390/htmintrin.h create mode 100644 gcc/config/s390/htmxlintrin.h create mode 100644 gcc/config/s390/s390intrin.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 999cb22e58d..310ca0532f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-14 Andreas Krebbel + + * config/s390/htmxlintrin.h: Add file missing from last commit. + * config/s390/htmintrin.h: Likewise. + * config/s390/s390intrin.h: Likewise. + 2013-08-14 Uros Bizjak Backport from mainline diff --git a/gcc/config/s390/htmintrin.h b/gcc/config/s390/htmintrin.h new file mode 100644 index 00000000000..7aaa9f5bf7c --- /dev/null +++ b/gcc/config/s390/htmintrin.h @@ -0,0 +1,57 @@ +/* GNU compiler hardware transactional execution intrinsics + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _HTMINTRIN_H +#define _HTMINTRIN_H + + +/* Condition codes generated by tbegin */ +#define _HTM_TBEGIN_STARTED 0 +#define _HTM_TBEGIN_INDETERMINATE 1 +#define _HTM_TBEGIN_TRANSIENT 2 +#define _HTM_TBEGIN_PERSISTENT 3 + +/* The abort codes below this threshold are reserved for machine + use. */ +#define _HTM_FIRST_USER_ABORT_CODE 256 + +/* The transaction diagnostic block is it is defined in the Principles + of Operation chapter 5-91. */ + +struct __htm_tdb { + unsigned char format; /* 0 */ + unsigned char flags; + unsigned char reserved1[4]; + unsigned short nesting_depth; + unsigned long long abort_code; /* 8 */ + unsigned long long conflict_token; /* 16 */ + unsigned long long atia; /* 24 */ + unsigned char eaid; /* 32 */ + unsigned char dxc; + unsigned char reserved2[2]; + unsigned int program_int_id; + unsigned long long exception_id; /* 40 */ + unsigned long long bea; /* 48 */ + unsigned char reserved3[72]; /* 56 */ + unsigned long long gprs[16]; /* 128 */ +} __attribute__((__packed__, __aligned__ (8))); + + +#endif /* _HTMINTRIN_H */ diff --git a/gcc/config/s390/htmxlintrin.h b/gcc/config/s390/htmxlintrin.h new file mode 100644 index 00000000000..bb142195b2b --- /dev/null +++ b/gcc/config/s390/htmxlintrin.h @@ -0,0 +1,182 @@ +/* XL compiler hardware transactional execution intrinsics + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _HTMXLINTRIN_H +#define _HTMXLINTRIN_H + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* These intrinsics are being made available for compatibility with + the IBM XL compiler. For documentation please see the "z/OS XL + C/C++ Programming Guide" publically available on the web. */ + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_simple_begin () +{ + return __builtin_tbegin_nofloat (0); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_begin (void* const tdb) +{ + return __builtin_tbegin_nofloat (tdb); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_end () +{ + return __builtin_tend (); +} + +extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_abort () +{ + return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE); +} + +extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_named_abort (unsigned char const code) +{ + return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + code); +} + +extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_non_transactional_store (void* const addr, long long const value) +{ + __builtin_non_tx_store ((uint64_t*)addr, (uint64_t)value); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_nesting_depth (void* const tdb_ptr) +{ + int depth = __builtin_tx_nesting_depth (); + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + if (depth != 0) + return depth; + + if (tdb->format == 0) + return 0; + return tdb->nesting_depth; +} + +/* Transaction failure diagnostics */ + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_user_abort (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + if (tdb->format == 0) + return 0; + + return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_named_user_abort (void* const tdb_ptr, unsigned char* code) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + if (tdb->format == 0) + return 0; + + if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE) + { + *code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE; + return 1; + } + return 0; +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_illegal (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + return (tdb->format == 0 + && (tdb->abort_code == 4 /* unfiltered program interruption */ + || tdb->abort_code == 11 /* restricted instruction */)); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_footprint_exceeded (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + return (tdb->format == 0 + && (tdb->abort_code == 7 /* fetch overflow */ + || tdb->abort_code == 8 /* store overflow */)); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_nested_too_deep (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + return tdb->format == 0 && tdb->abort_code == 13; /* depth exceeded */ +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_conflict (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + return (tdb->format == 0 + && (tdb->abort_code == 9 /* fetch conflict */ + || tdb->abort_code == 10 /* store conflict */)); +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_is_failure_persistent (long const result) +{ + return result == _HTM_TBEGIN_PERSISTENT; +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_failure_address (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; +#ifdef __s390x__ + return tdb->atia; +#else + return tdb->atia & 0xffffffff; +#endif +} + +extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +__TM_failure_code (void* const tdb_ptr) +{ + struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr; + + return tdb->abort_code; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _HTMXLINTRIN_H */ diff --git a/gcc/config/s390/s390intrin.h b/gcc/config/s390/s390intrin.h new file mode 100644 index 00000000000..e1a00ce58e3 --- /dev/null +++ b/gcc/config/s390/s390intrin.h @@ -0,0 +1,33 @@ +/* S/390 System z specific intrinsics + Copyright (C) 2013 Free Software Foundation, Inc. + Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _S390INTRIN_H +#define _S390INTRIN_H + +#ifndef __s390__ + #error s390intrin.h included on wrong platform/compiler +#endif + +#ifdef __HTM__ +#include +#endif + + +#endif /* _S390INTRIN_H*/ -- cgit v1.2.3 From 8881ed3db5099022532fda5ec6e4f1b66dc66e45 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 14 Aug 2013 20:36:12 +0000 Subject: PR tree-optimization/58145 * tree-sra.c (build_ref_for_offset): If prev_base has TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS, propagate it to MEM_REF. * gcc.dg/pr58145-1.c: New test. * gcc.dg/pr58145-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201749 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/gcc.dg/pr58145-1.c | 37 +++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr58145-2.c | 51 ++++++++++++++++++++++++++++++++++++++++ gcc/tree-sra.c | 8 ++++++- 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr58145-1.c create mode 100644 gcc/testsuite/gcc.dg/pr58145-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 310ca0532f7..354307fa0a3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-14 Jakub Jelinek + + PR tree-optimization/58145 + * tree-sra.c (build_ref_for_offset): If prev_base has + TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS, propagate it to MEM_REF. + 2013-08-14 Andreas Krebbel * config/s390/htmxlintrin.h: Add file missing from last commit. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a305735aa24..c88cb4d3d34 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-08-14 Jakub Jelinek + + PR tree-optimization/58145 + * gcc.dg/pr58145-1.c: New test. + * gcc.dg/pr58145-2.c: New test. + 2013-08-13 Jakub Jelinek PR sanitizer/56417 diff --git a/gcc/testsuite/gcc.dg/pr58145-1.c b/gcc/testsuite/gcc.dg/pr58145-1.c new file mode 100644 index 00000000000..0e236c0456d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58145-1.c @@ -0,0 +1,37 @@ +/* PR tree-optimization/58145 */ +/* { dg-do compile { target { int32plus } } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct S { unsigned int data : 32; }; +struct T { unsigned int data; }; +volatile struct S s2; + +void +f1 (int val) +{ + struct S s = { .data = val }; + *(volatile struct S *) 0x880000UL = s; +} + +void +f2 (int val) +{ + struct T t = { .data = val }; + *(volatile struct T *) 0x880000UL = t; +} + +void +f3 (int val) +{ + *(volatile unsigned int *) 0x880000UL = val; +} + +void +f4 (int val) +{ + struct S s = { .data = val }; + s2 = s; +} + +/* { dg-final { scan-tree-dump-times " ={v} " 4 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr58145-2.c b/gcc/testsuite/gcc.dg/pr58145-2.c new file mode 100644 index 00000000000..840e9828972 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58145-2.c @@ -0,0 +1,51 @@ +/* PR tree-optimization/58145 */ +/* { dg-do compile { target { int32plus } } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +struct S { unsigned int data : 32; }; +struct T { unsigned int data; }; +volatile struct S s2; + +static inline void +f1 (int val) +{ + struct S s = { .data = val }; + *(volatile struct S *) 0x880000UL = s; +} + +static inline void +f2 (int val) +{ + struct T t = { .data = val }; + *(volatile struct T *) 0x880000UL = t; +} + +static inline void +f3 (int val) +{ + *(volatile unsigned int *) 0x880000UL = val; +} + +static inline void +f4 (int val) +{ + struct S s = { .data = val }; + s2 = s; +} + +void +f5 (void) +{ + int i; + for (i = 0; i < 100; i++) + f1 (0); + for (i = 0; i < 100; i++) + f2 (0); + for (i = 0; i < 100; i++) + f3 (0); + for (i = 0; i < 100; i++) + f4 (0); +} + +/* { dg-final { scan-tree-dump-times " ={v} " 4 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index bb04fd74446..627fadc66a6 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1440,6 +1440,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, { tree prev_base = base; tree off; + tree mem_ref; HOST_WIDE_INT base_offset; unsigned HOST_WIDE_INT misalign; unsigned int align; @@ -1490,7 +1491,12 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, if (align < TYPE_ALIGN (exp_type)) exp_type = build_aligned_type (exp_type, align); - return fold_build2_loc (loc, MEM_REF, exp_type, base, off); + mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off); + if (TREE_THIS_VOLATILE (prev_base)) + TREE_THIS_VOLATILE (mem_ref) = 1; + if (TREE_SIDE_EFFECTS (prev_base)) + TREE_SIDE_EFFECTS (mem_ref) = 1; + return mem_ref; } /* Construct a memory reference to a part of an aggregate BASE at the given -- cgit v1.2.3 From 1cbdd9255f5ff4bdb0a9248a6f4869b48201e684 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 14 Aug 2013 20:39:49 +0000 Subject: 2013-08-14 Andreas Krebbel Revert: 2013-08-02 Andreas Krebbel * configure.tgt: Add -msoft-float to XCFLAGS. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201751 138bc75d-0d04-0410-961f-82ee72b054a4 --- libitm/ChangeLog | 8 ++++++++ libitm/configure.tgt | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 1f6b22d345a..287bf737047 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,11 @@ +2013-08-14 Andreas Krebbel + + Revert: + 2013-08-02 Andreas Krebbel + + * configure.tgt: Add -msoft-float to XCFLAGS. + + 2013-08-14 Andreas Krebbel * config/s390/sjlj.S: Add file missing from last commit. diff --git a/libitm/configure.tgt b/libitm/configure.tgt index 0944b7b16a7..a20b410e0db 100644 --- a/libitm/configure.tgt +++ b/libitm/configure.tgt @@ -106,7 +106,7 @@ case "${target_cpu}" in ARCH=x86 ;; s390|s390x) - XCFLAGS="${XCFLAGS} -mzarch -mhtm -msoft-float" + XCFLAGS="${XCFLAGS} -mzarch -mhtm" ARCH=s390 ;; -- cgit v1.2.3 From 870f8283020ef173647ddcd1e91dfb722b689382 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 15 Aug 2013 00:16:31 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201757 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6c3731088a1..9ca2dbb5530 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130814 +20130815 -- cgit v1.2.3 From e76bac4bb2e6e3c38612a882859d9940c0dcc88a Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Thu, 15 Aug 2013 08:03:32 +0000 Subject: 2013-08-15 David Given Backport from mainline 2013-04-26 Vladimir Makarov * lra-constraints.c (process_alt_operands): Use #if HAVE_ATTR_enable instead of #ifdef. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201764 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/lra-constraints.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 354307fa0a3..9729ce3ba72 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-08-15 David Given + + Backport from mainline + 2013-04-26 Vladimir Makarov + + * lra-constraints.c (process_alt_operands): Use #if HAVE_ATTR_enable + instead of #ifdef. + 2013-08-14 Jakub Jelinek PR tree-optimization/58145 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 2d8aa810eb9..32e8c45f287 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1388,7 +1388,7 @@ process_alt_operands (int only_alternative) for (nalt = 0; nalt < n_alternatives; nalt++) { /* Loop over operands for one constraint alternative. */ -#ifdef HAVE_ATTR_enabled +#if HAVE_ATTR_enabled if (curr_id->alternative_enabled_p != NULL && ! curr_id->alternative_enabled_p[nalt]) continue; -- cgit v1.2.3 From d79083c53f7a22f8d36420ba2ae0944951976e8b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 16 Aug 2013 00:16:32 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9ca2dbb5530..bbb921dec99 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130815 +20130816 -- cgit v1.2.3 From 52a2bbf9c101ded60dcbe16a7af466e439f00807 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Aug 2013 09:04:52 +0000 Subject: PR tree-optimization/58165 * tree-call-cdce.c (shrink_wrap_one_built_in_call): If bi_call must be the last stmt in a bb, don't split_block, instead use fallthru edge from it and give up if there is none. Release conds vector when returning early. * g++.dg/opt/pr58165.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201781 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr58165.C | 14 ++++++++++++++ gcc/tree-call-cdce.c | 23 ++++++++++++++++++----- 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr58165.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9729ce3ba72..223b0a136af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-08-16 Jakub Jelinek + + PR tree-optimization/58165 + * tree-call-cdce.c (shrink_wrap_one_built_in_call): If + bi_call must be the last stmt in a bb, don't split_block, instead + use fallthru edge from it and give up if there is none. + Release conds vector when returning early. + 2013-08-15 David Given Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c88cb4d3d34..e5e695a2d96 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-16 Jakub Jelinek + + PR tree-optimization/58165 + * g++.dg/opt/pr58165.C: New test. + 2013-08-14 Jakub Jelinek PR tree-optimization/58145 diff --git a/gcc/testsuite/g++.dg/opt/pr58165.C b/gcc/testsuite/g++.dg/opt/pr58165.C new file mode 100644 index 00000000000..d758e370050 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr58165.C @@ -0,0 +1,14 @@ +// PR tree-optimization/58165 +// { dg-do compile } +// { dg-options "-O2" } + +extern "C" float sqrtf (float); + +struct A { A (); ~A (); }; + +void +foo (double d) +{ + A a; + sqrtf (d); +} diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c index 9b6186e3393..f145f1752c9 100644 --- a/gcc/tree-call-cdce.c +++ b/gcc/tree-call-cdce.c @@ -726,15 +726,28 @@ shrink_wrap_one_built_in_call (gimple bi_call) return false and do not do any transformation for the call. */ if (nconds == 0) - return false; + { + conds.release (); + return false; + } bi_call_bb = gimple_bb (bi_call); - /* Now find the join target bb -- split - bi_call_bb if needed. */ - bi_call_bsi = gsi_for_stmt (bi_call); + /* Now find the join target bb -- split bi_call_bb if needed. */ + if (stmt_ends_bb_p (bi_call)) + { + /* If the call must be the last in the bb, don't split the block, + it could e.g. have EH edges. */ + join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs); + if (join_tgt_in_edge_from_call == NULL) + { + conds.release (); + return false; + } + } + else + join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call); - join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call); bi_call_bsi = gsi_for_stmt (bi_call); join_tgt_bb = join_tgt_in_edge_from_call->dest; -- cgit v1.2.3 From 20601ac26172363fb03b7aa7bda175d9ad650d2f Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 16 Aug 2013 09:06:41 +0000 Subject: PR tree-optimization/58164 * gimple.c (walk_stmt_load_store_addr_ops): For visit_addr walk gimple_goto_dest of GIMPLE_GOTO. * gcc.c-torture/compile/pr58164.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201784 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/gimple.c | 7 +++++++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.c-torture/compile/pr58164.c | 8 ++++++++ 4 files changed, 22 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr58164.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 223b0a136af..bdcb43f7a38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2013-08-16 Jakub Jelinek + PR tree-optimization/58164 + * gimple.c (walk_stmt_load_store_addr_ops): For visit_addr + walk gimple_goto_dest of GIMPLE_GOTO. + PR tree-optimization/58165 * tree-call-cdce.c (shrink_wrap_one_built_in_call): If bi_call must be the last stmt in a bb, don't split_block, instead diff --git a/gcc/gimple.c b/gcc/gimple.c index 785c2f021a7..97a37e32df7 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -4045,6 +4045,13 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data, ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); } } + else if (visit_addr + && gimple_code (stmt) == GIMPLE_GOTO) + { + tree op = gimple_goto_dest (stmt); + if (TREE_CODE (op) == ADDR_EXPR) + ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data); + } return ret; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e5e695a2d96..e196017e2ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-08-16 Jakub Jelinek + PR tree-optimization/58164 + * gcc.c-torture/compile/pr58164.c: New test. + PR tree-optimization/58165 * g++.dg/opt/pr58165.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58164.c b/gcc/testsuite/gcc.c-torture/compile/pr58164.c new file mode 100644 index 00000000000..7fe24fa439f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr58164.c @@ -0,0 +1,8 @@ +/* PR tree-optimization/58164 */ + +int +foo (void) +{ + int x = 0; + goto *&x; +} -- cgit v1.2.3 From b9aeeff4dec614bc58dee1ca51f736e32347130b Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 16 Aug 2013 17:43:39 +0000 Subject: * src/c++98/compatibility.cc (_ZTIe): Use reinterpret_cast to avoid -Wcast-qual warnings. (_ZTIPe): Ditto. (ZTIPKe): Ditto. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201796 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/src/c++98/compatibility.cc | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 460f20e4745..59a868684d5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2013-08-16 Uros Bizjak + + * src/c++98/compatibility.cc (_ZTIe): Use + reinterpret_cast to avoid -Wcast-qual warnings. + (_ZTIPe): Ditto. + (ZTIPKe): Ditto. + 2013-08-07 Paolo Carlini * include/ext/atomicity.h: Add #pragma GCC system_header. diff --git a/libstdc++-v3/src/c++98/compatibility.cc b/libstdc++-v3/src/c++98/compatibility.cc index d964e89db4c..3f21c581ec1 100644 --- a/libstdc++-v3/src/c++98/compatibility.cc +++ b/libstdc++-v3/src/c++98/compatibility.cc @@ -517,14 +517,21 @@ extern __attribute__((used, weak)) const char _ZTSe[2] = "e"; extern __attribute__((used, weak)) const char _ZTSPe[3] = "Pe"; extern __attribute__((used, weak)) const char _ZTSPKe[4] = "PKe"; extern __attribute__((used, weak)) const void * const _ZTIe[2] - = { (void *) &_ZTVN10__cxxabiv123__fundamental_type_infoE[2], - (void *) _ZTSe }; + = { reinterpret_cast + (&_ZTVN10__cxxabiv123__fundamental_type_infoE[2]), + reinterpret_cast(_ZTSe) }; extern __attribute__((used, weak)) const void * const _ZTIPe[4] - = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPe, (void *) 0L, (void *) _ZTIe }; + = { reinterpret_cast + (&_ZTVN10__cxxabiv119__pointer_type_infoE[2]), + reinterpret_cast(_ZTSPe), + reinterpret_cast(0L), + reinterpret_cast(_ZTIe) }; extern __attribute__((used, weak)) const void * const _ZTIPKe[4] - = { (void *) &_ZTVN10__cxxabiv119__pointer_type_infoE[2], - (void *) _ZTSPKe, (void *) 1L, (void *) _ZTIe }; + = { reinterpret_cast + (&_ZTVN10__cxxabiv119__pointer_type_infoE[2]), + reinterpret_cast(_ZTSPKe), + reinterpret_cast(1L), + reinterpret_cast(_ZTIe) }; #endif // _GLIBCXX_LONG_DOUBLE_COMPAT #ifdef _GLIBCXX_SYMVER_DARWIN -- cgit v1.2.3 From 15021af997cfe1fc99301bb539df276f69585f29 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 17 Aug 2013 00:16:23 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201810 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index bbb921dec99..c83faabf30a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130816 +20130817 -- cgit v1.2.3 From 1835eba99a051e9e07525c724076e982679ee1e3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 17 Aug 2013 18:04:58 +0000 Subject: compiler: Don't generate value reference in range clause if receiver is a sink. The panic in test/fixedbugs/bug454.go was caused by the generation of an unnecessary var reference when writing a range value into a sink. If the receiving variable is a sink, there's no need to dereference a possible NULL pointer. Fixes Issue 24. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201816 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/parse.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 429d91bafe2..9d112850fee 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -5266,7 +5266,8 @@ Parse::range_clause_decl(const Typed_identifier_list* til, no->var_value()->set_type_from_range_value(); if (is_new) any_new = true; - p_range_clause->value = Expression::make_var_reference(no, location); + if (!Gogo::is_sink_name(pti->name())) + p_range_clause->value = Expression::make_var_reference(no, location); } if (!any_new) -- cgit v1.2.3 From 87e14b46a8fded273e6d48875b7943e3ae5c6400 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 18 Aug 2013 00:16:22 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201820 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c83faabf30a..b68ea252647 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130817 +20130818 -- cgit v1.2.3 From 5a569d9739fd0a5d80128da1d0fbc04db1d83261 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 18 Aug 2013 01:07:02 +0000 Subject: PR c++/58083 * name-lookup.c (push_class_level_binding_1): It's OK to push a lambda type after the enclosing type is complete. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201823 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 +++++ gcc/cp/name-lookup.c | 6 +++-- gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C | 30 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fde680d0def..f17d4c221cf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-08-17 Jason Merrill + + PR c++/58083 + * name-lookup.c (push_class_level_binding_1): It's OK to push a + lambda type after the enclosing type is complete. + 2013-08-06 Jason Merrill PR c++/57825 diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 2a47331ea73..c121a4163a9 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -3015,8 +3015,10 @@ push_class_level_binding_1 (tree name, tree x) if (name == error_mark_node) return false; - /* Check for invalid member names. */ - gcc_assert (TYPE_BEING_DEFINED (current_class_type)); + /* Check for invalid member names. But don't worry about a default + argument-scope lambda being pushed after the class is complete. */ + gcc_assert (TYPE_BEING_DEFINED (current_class_type) + || LAMBDA_TYPE_P (TREE_TYPE (decl))); /* Check that we're pushing into the right binding level. */ gcc_assert (current_class_type == class_binding_level->this_entity); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C new file mode 100644 index 00000000000..d85918dd07b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-defarg5.C @@ -0,0 +1,30 @@ +// PR c++/58083 +// { dg-do compile { target c++11 } } + +namespace details { +struct iterator_concept_checker +{ + typedef char yes_type; + typedef char (&no_type)[2]; + + template + static no_type test(...); + + template + static yes_type test( + int* + , void (*)(T) = [](T it) + { + auto copy = T{it}; // copy constructible + copy = it; // copy assignable + copy.~T(); // destroyable + ++it; // incrementable + } + ); +}; +} + +int main() +{ + details::iterator_concept_checker::test(0); +} -- cgit v1.2.3 From 44301ccad6d0ed0104ab0d1aae518aba166283c3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 18 Aug 2013 15:24:12 +0000 Subject: PR tree-optimization/58006 * tree-parloops.c (take_address_of): Don't ICE if get_name returns NULL. (eliminate_local_variables_stmt): Remove clobber stmts. * g++.dg/opt/pr58006.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201828 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr58006.C | 22 ++++++++++++++++++++++ gcc/tree-parloops.c | 15 ++++++++++++--- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr58006.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bdcb43f7a38..a6ef4d79e3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-18 Jakub Jelinek + + PR tree-optimization/58006 + * tree-parloops.c (take_address_of): Don't ICE if get_name + returns NULL. + (eliminate_local_variables_stmt): Remove clobber stmts. + 2013-08-16 Jakub Jelinek PR tree-optimization/58164 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e196017e2ea..ec5d8550989 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-18 Jakub Jelinek + + PR tree-optimization/58006 + * g++.dg/opt/pr58006.C: New test. + 2013-08-16 Jakub Jelinek PR tree-optimization/58164 diff --git a/gcc/testsuite/g++.dg/opt/pr58006.C b/gcc/testsuite/g++.dg/opt/pr58006.C new file mode 100644 index 00000000000..fd3b7bebd8a --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr58006.C @@ -0,0 +1,22 @@ +// PR tree-optimization/58006 +// { dg-do compile } +// { dg-require-effective-target pthread } +// { dg-options "-Ofast -ftree-parallelize-loops=2" } + +extern "C" float sqrtf (float); + +struct S +{ + float i, j; + float foo () const { return sqrtf (i * i + j * j); } + S () : i (1), j (1) {} +}; + +void +bar (int a, int b) +{ + int i; + float f; + for (i = a; i < b; i++) + f = S ().foo (); +} diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index d7b846ae79b..9d2c3ca3b41 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -478,9 +478,12 @@ take_address_of (tree obj, tree type, edge entry, htab_t decl_address, if (gsi == NULL) return NULL; addr = TREE_OPERAND (*var_p, 0); - name = make_temp_ssa_name (TREE_TYPE (addr), NULL, - get_name (TREE_OPERAND - (TREE_OPERAND (*var_p, 0), 0))); + const char *obj_name + = get_name (TREE_OPERAND (TREE_OPERAND (*var_p, 0), 0)); + if (obj_name) + name = make_temp_ssa_name (TREE_TYPE (addr), NULL, obj_name); + else + name = make_ssa_name (TREE_TYPE (addr), NULL); stmt = gimple_build_assign (name, addr); gsi_insert_on_edge_immediate (entry, stmt); @@ -679,6 +682,12 @@ eliminate_local_variables_stmt (edge entry, gimple_stmt_iterator *gsi, dta.changed = true; } } + else if (gimple_clobber_p (stmt)) + { + stmt = gimple_build_nop (); + gsi_replace (gsi, stmt, false); + dta.changed = true; + } else { dta.gsi = gsi; -- cgit v1.2.3 From 2505700945d985165b9dbf7935505486ad705a2e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 19 Aug 2013 00:16:39 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201831 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b68ea252647..c84a8e2f7b9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130818 +20130819 -- cgit v1.2.3 From a61569b913b603d1e803d0fa5af4ecebf726592a Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Mon, 19 Aug 2013 17:55:50 +0000 Subject: Backport from mainline * config/rs6000/dfp.md (*negtd2_fpr): Handle non-overlapping destination and source operands. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201850 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/rs6000/dfp.md | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6ef4d79e3d..02e6c578cd5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-19 Peter Bergner + Jakub Jelinek + + Backport from mainline + * config/rs6000/dfp.md (*negtd2_fpr): Handle non-overlapping destination + and source operands. + 2013-08-18 Jakub Jelinek PR tree-optimization/58006 diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md index f73e115e342..040bae49001 100644 --- a/gcc/config/rs6000/dfp.md +++ b/gcc/config/rs6000/dfp.md @@ -394,11 +394,14 @@ "") (define_insn "*negtd2_fpr" - [(set (match_operand:TD 0 "gpc_reg_operand" "=d") - (neg:TD (match_operand:TD 1 "gpc_reg_operand" "d")))] + [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") + (neg:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))] "TARGET_HARD_FLOAT && TARGET_FPRS" - "fneg %0,%1" - [(set_attr "type" "fp")]) + "@ + fneg %0,%1 + fneg %0,%1\;fmr %L0,%L1" + [(set_attr "type" "fp") + (set_attr "length" "4,8")]) (define_expand "abstd2" [(set (match_operand:TD 0 "gpc_reg_operand" "") -- cgit v1.2.3 From 8107d17357b48cc62648c2d3a91de70dbe46580b Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Mon, 19 Aug 2013 19:17:50 +0000 Subject: Backport from mainline gcc/ * builtins.def (BUILT_IN_FABSD32): New DFP ABS builtin. (BUILT_IN_FABSD64): Likewise. (BUILT_IN_FABSD128): Likewise. * builtins.c (expand_builtin): Add support for new DFP ABS builtins. (fold_builtin_1): Likewise. * config/rs6000/dfp.md (*negtd2_fpr): Handle non-overlapping destination and source operands. (*abstd2_fpr): Likewise. (*nabstd2_fpr): Likewise. gcc/testsuite/ * gcc.target/powerpc/dfp-dd-2.c: New test. * gcc.target/powerpc/dfp-td-2.c: Likewise. * gcc.target/powerpc/dfp-td-3.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@201854 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.ibm | 21 ++++++++++++++++++ gcc/builtins.c | 6 ++++++ gcc/builtins.def | 3 +++ gcc/config/rs6000/dfp.md | 33 ++++++++++++++++++----------- gcc/testsuite/ChangeLog.ibm | 9 ++++++++ gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c | 26 +++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/dfp-td-2.c | 29 +++++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/dfp-td-3.c | 29 +++++++++++++++++++++++++ 8 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/dfp-td-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/dfp-td-3.c diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index cdf4e6711e7..81306b5bed1 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -1,3 +1,24 @@ +2013-08-19 Peter Bergner + + Backport from mainline + 2013-08-19 Peter Bergner + Jakub Jelinek + + * builtins.def (BUILT_IN_FABSD32): New DFP ABS builtin. + (BUILT_IN_FABSD64): Likewise. + (BUILT_IN_FABSD128): Likewise. + * builtins.c (expand_builtin): Add support for + new DFP ABS builtins. + (fold_builtin_1): Likewise. + * config/rs6000/dfp.md + (*negtd2_fpr): Handle + non-overlapping destination + and source operands. + (*abstd2_fpr): + Likewise. + (*nabstd2_fpr): + Likewise. + 2013-08-16 Michael Meissner Backport from trunk diff --git a/gcc/builtins.c b/gcc/builtins.c index e3c32a91c64..6e4b841d483 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5846,6 +5846,9 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, switch (fcode) { CASE_FLT_FN (BUILT_IN_FABS): + case BUILT_IN_FABSD32: + case BUILT_IN_FABSD64: + case BUILT_IN_FABSD128: target = expand_builtin_fabs (exp, target, subtarget); if (target) return target; @@ -10298,6 +10301,9 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore) return fold_builtin_strlen (loc, type, arg0); CASE_FLT_FN (BUILT_IN_FABS): + case BUILT_IN_FABSD32: + case BUILT_IN_FABSD64: + case BUILT_IN_FABSD128: return fold_builtin_fabs (loc, arg0, type); case BUILT_IN_ABS: diff --git a/gcc/builtins.def b/gcc/builtins.def index 4f378fad60b..d5afe0d054e 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -252,6 +252,9 @@ DEF_C99_BUILTIN (BUILT_IN_EXPM1L, "expm1l", BT_FN_LONGDOUBLE_LONGDOUBLE, DEF_LIB_BUILTIN (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSF, "fabsf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSL, "fabsl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST) +DEF_GCC_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST) DEF_C99_BUILTIN (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO) DEF_C99_BUILTIN (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO) diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md index 052ac482e0f..9a846239b04 100644 --- a/gcc/config/rs6000/dfp.md +++ b/gcc/config/rs6000/dfp.md @@ -132,11 +132,14 @@ "") (define_insn "*negtd2_fpr" - [(set (match_operand:TD 0 "gpc_reg_operand" "=d") - (neg:TD (match_operand:TD 1 "gpc_reg_operand" "d")))] + [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") + (neg:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))] "TARGET_HARD_FLOAT && TARGET_FPRS" - "fneg %0,%1" - [(set_attr "type" "fp")]) + "@ + fneg %0,%1 + fneg %0,%1\;fmr %L0,%L1" + [(set_attr "type" "fp") + (set_attr "length" "4,8")]) (define_expand "abstd2" [(set (match_operand:TD 0 "gpc_reg_operand" "") @@ -145,18 +148,24 @@ "") (define_insn "*abstd2_fpr" - [(set (match_operand:TD 0 "gpc_reg_operand" "=d") - (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d")))] + [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") + (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))] "TARGET_HARD_FLOAT && TARGET_FPRS" - "fabs %0,%1" - [(set_attr "type" "fp")]) + "@ + fabs %0,%1 + fabs %0,%1\;fmr %L0,%L1" + [(set_attr "type" "fp") + (set_attr "length" "4,8")]) (define_insn "*nabstd2_fpr" - [(set (match_operand:TD 0 "gpc_reg_operand" "=d") - (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d"))))] + [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d") + (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d"))))] "TARGET_HARD_FLOAT && TARGET_FPRS" - "fnabs %0,%1" - [(set_attr "type" "fp")]) + "@ + fnabs %0,%1 + fnabs %0,%1\;fmr %L0,%L1" + [(set_attr "type" "fp") + (set_attr "length" "4,8")]) ;; Hardware support for decimal floating point operations. diff --git a/gcc/testsuite/ChangeLog.ibm b/gcc/testsuite/ChangeLog.ibm index f1151ec2920..760f288f945 100644 --- a/gcc/testsuite/ChangeLog.ibm +++ b/gcc/testsuite/ChangeLog.ibm @@ -1,3 +1,12 @@ +2013-08-19 Peter Bergner + + Back port from mainline + 2013-08-19 Peter Bergner + + * gcc.target/powerpc/dfp-dd-2.c: New test. + * gcc.target/powerpc/dfp-td-2.c: Likewise. + * gcc.target/powerpc/dfp-td-3.c: Likewise. + 2013-08-16 Michael Meissner Backport from trunk. diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c b/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c new file mode 100644 index 00000000000..fcb72bdff2b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c @@ -0,0 +1,26 @@ +/* Test generation of DFP instructions for POWER6. */ +/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ + +/* { dg-final { scan-assembler-times "fneg" 1 } } */ +/* { dg-final { scan-assembler-times "fabs" 1 } } */ +/* { dg-final { scan-assembler-times "fnabs" 1 } } */ +/* { dg-final { scan-assembler-times "fmr" 0 } } */ + +_Decimal64 +func1 (_Decimal64 a, _Decimal64 b) +{ + return -b; +} + +_Decimal64 +func2 (_Decimal64 a, _Decimal64 b) +{ + return __builtin_fabsd64 (b); +} + +_Decimal64 +func3 (_Decimal64 a, _Decimal64 b) +{ + return - __builtin_fabsd64 (b); +} diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c b/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c new file mode 100644 index 00000000000..a078cc46980 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c @@ -0,0 +1,29 @@ +/* Test generation of DFP instructions for POWER6. */ +/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ + +/* { dg-final { scan-assembler-times "fneg" 1 } } */ +/* { dg-final { scan-assembler-times "fabs" 1 } } */ +/* { dg-final { scan-assembler-times "fnabs" 1 } } */ +/* { dg-final { scan-assembler-times "fmr" 0 } } */ + +/* These tests verify we only generate fneg, fabs and fnabs + instructions and no fmr's since these are done in place. */ + +_Decimal128 +func1 (_Decimal128 a) +{ + return -a; +} + +_Decimal128 +func2 (_Decimal128 a) +{ + return __builtin_fabsd128 (a); +} + +_Decimal128 +func3 (_Decimal128 a) +{ + return - __builtin_fabsd128 (a); +} diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c b/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c new file mode 100644 index 00000000000..e825e5cad28 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c @@ -0,0 +1,29 @@ +/* Test generation of DFP instructions for POWER6. */ +/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */ +/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */ + +/* { dg-final { scan-assembler-times "fneg" 1 } } */ +/* { dg-final { scan-assembler-times "fabs" 1 } } */ +/* { dg-final { scan-assembler-times "fnabs" 1 } } */ +/* { dg-final { scan-assembler-times "fmr" 3 } } */ + +/* These tests verify we generate fneg, fabs and fnabs and + associated fmr's since these are not done in place. */ + +_Decimal128 +func1 (_Decimal128 a, _Decimal128 b) +{ + return -b; +} + +_Decimal128 +func2 (_Decimal128 a, _Decimal128 b) +{ + return __builtin_fabsd128 (b); +} + +_Decimal128 +func3 (_Decimal128 a, _Decimal128 b) +{ + return - __builtin_fabsd128 (b); +} -- cgit v1.2.3 From d70c93b691ac1ee5225f81c19c0a976ff107ad12 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 20 Aug 2013 00:16:48 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201862 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c84a8e2f7b9..edd7430ef82 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130819 +20130820 -- cgit v1.2.3 From 50dae77215185b26f20d294e86b86281a8978418 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 20 Aug 2013 01:05:10 +0000 Subject: PR target/57865 * config/rs6000/rs6000.c (rs6000_emit_prologue): Correct ool_adjust. (rs6000_emit_epilogue): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201866 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000.c | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 02e6c578cd5..aea18a64aad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-20 Alan Modra + + PR target/57865 + * config/rs6000/rs6000.c (rs6000_emit_prologue): Correct ool_adjust. + (rs6000_emit_epilogue): Likewise. + 2013-08-19 Peter Bergner Jakub Jelinek diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d92248ed404..e8266decb90 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -19960,8 +19960,7 @@ rs6000_emit_prologue (void) HOST_WIDE_INT offset; if (!(strategy & SAVE_INLINE_GPRS)) - ool_adjust = 8 * (info->first_gp_reg_save - - (FIRST_SAVRES_REGISTER + 1)); + ool_adjust = 8 * (info->first_gp_reg_save - FIRST_SAVED_GP_REGNO); offset = info->spe_gp_save_offset + frame_off - ool_adjust; spe_save_area_ptr = gen_rtx_REG (Pmode, 11); save_off = frame_off - offset; @@ -21203,8 +21202,7 @@ rs6000_emit_epilogue (int sibcall) anew to every function. */ if (!restoring_GPRs_inline) - ool_adjust = 8 * (info->first_gp_reg_save - - (FIRST_SAVRES_REGISTER + 1)); + ool_adjust = 8 * (info->first_gp_reg_save - FIRST_SAVED_GP_REGNO); frame_reg_rtx = gen_rtx_REG (Pmode, 11); emit_insn (gen_addsi3 (frame_reg_rtx, old_frame_reg_rtx, GEN_INT (info->spe_gp_save_offset -- cgit v1.2.3 From 71ee94a3f5dd85dabaf16b2c315dbc49474a26e4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 20 Aug 2013 11:56:29 +0000 Subject: 2013-08-20 Paolo Carlini PR c++/58190 * g++.dg/pr57878.C: Use __SIZE_TYPE__. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201876 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/pr57878.C | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ec5d8550989..8dac4942e78 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-20 Paolo Carlini + + PR c++/58190 + * g++.dg/pr57878.C: Use __SIZE_TYPE__. + 2013-08-18 Jakub Jelinek PR tree-optimization/58006 @@ -110,7 +115,7 @@ 2013-07-18 Wei Mi PR rtl-optimization/57878 - * g++.dg/pr57518.C: New test. + * g++.dg/pr57878.C: New test. 2013-07-19 Georg-Johann Lay diff --git a/gcc/testsuite/g++.dg/pr57878.C b/gcc/testsuite/g++.dg/pr57878.C index b1aa25c486c..da4fc4bb563 100644 --- a/gcc/testsuite/g++.dg/pr57878.C +++ b/gcc/testsuite/g++.dg/pr57878.C @@ -6,7 +6,7 @@ typedef long long int64; typedef unsigned int uint32; typedef unsigned long long uint64; namespace std { - typedef unsigned int size_t; + typedef __SIZE_TYPE__ size_t; template struct char_traits; template @@ -22,7 +22,7 @@ namespace std { return static_cast<_Tp&&>(__t); } } -typedef unsigned int size_t; +typedef __SIZE_TYPE__ size_t; extern "C++" { inline void* operator new(std::size_t, void* __p) noexcept { return __p; -- cgit v1.2.3 From 57f4f4502f48d9cd319d57290f61d50d4e0d5aad Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 20 Aug 2013 12:14:43 +0000 Subject: /testsuite 2013-07-25 Paolo Carlini PR c++/57981 * g++.dg/cpp0x/pr57981.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201877 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/g++.dg/cpp0x/pr57981.C | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/pr57981.C diff --git a/gcc/testsuite/g++.dg/cpp0x/pr57981.C b/gcc/testsuite/g++.dg/cpp0x/pr57981.C new file mode 100644 index 00000000000..5ee1f0ed6ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr57981.C @@ -0,0 +1,17 @@ +// { dg-options "-std=c++11 -Wall -Wextra" } + +template +void f(T t, void* = 0) // { dg-warning "unused parameter" } +{ +} + +template +auto g(T t) -> decltype(f(t)) +{ + f(t); +} + +int main() +{ + g(0); +} -- cgit v1.2.3 From b44994c6aa2aceb8235c39face4686951c8143da Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 20 Aug 2013 12:59:37 +0000 Subject: PR c++/58119 * cp-tree.h (WILDCARD_TYPE_P): Split out from... (MAYBE_CLASS_TYPE_P): ...here. * cvt.c (build_expr_type_conversion): Don't complain about a template that can't match the desired type category. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201882 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 8 ++++++++ gcc/cp/cp-tree.h | 17 ++++++++++------- gcc/cp/cvt.c | 23 ++++++++++++----------- gcc/testsuite/g++.dg/template/delete2.C | 26 ++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 gcc/testsuite/g++.dg/template/delete2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f17d4c221cf..b5dc49e9627 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2013-08-20 Jason Merrill + + PR c++/58119 + * cp-tree.h (WILDCARD_TYPE_P): Split out from... + (MAYBE_CLASS_TYPE_P): ...here. + * cvt.c (build_expr_type_conversion): Don't complain about a + template that can't match the desired type category. + 2013-08-17 Jason Merrill PR c++/58083 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b10c53bc499..71b5bf6c96c 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1211,17 +1211,20 @@ enum languages { lang_c, lang_cplusplus, lang_java }; /* The _DECL for this _TYPE. */ #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE))) -/* Nonzero if T is a class (or struct or union) type. Also nonzero - for template type parameters, typename types, and instantiated - template template parameters. Keep these checks in ascending code - order. */ -#define MAYBE_CLASS_TYPE_P(T) \ +/* Nonzero if T is a type that could resolve to any kind of concrete type + at instantiation time. */ +#define WILDCARD_TYPE_P(T) \ (TREE_CODE (T) == TEMPLATE_TYPE_PARM \ || TREE_CODE (T) == TYPENAME_TYPE \ || TREE_CODE (T) == TYPEOF_TYPE \ || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \ - || TREE_CODE (T) == DECLTYPE_TYPE \ - || CLASS_TYPE_P (T)) + || TREE_CODE (T) == DECLTYPE_TYPE) + +/* Nonzero if T is a class (or struct or union) type. Also nonzero + for template type parameters, typename types, and instantiated + template template parameters. Keep these checks in ascending code + order. */ +#define MAYBE_CLASS_TYPE_P(T) (WILDCARD_TYPE_P (T) || CLASS_TYPE_P (T)) /* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or union type. */ diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index f83f3704927..8c03e2086ce 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1583,17 +1583,6 @@ build_expr_type_conversion (int desires, tree expr, bool complain) if (DECL_NONCONVERTING_P (cand)) continue; - if (TREE_CODE (cand) == TEMPLATE_DECL) - { - if (complain) - { - error ("ambiguous default type conversion from %qT", - basetype); - error (" candidate conversions include %qD", cand); - } - return error_mark_node; - } - candidate = non_reference (TREE_TYPE (TREE_TYPE (cand))); switch (TREE_CODE (candidate)) @@ -1627,11 +1616,23 @@ build_expr_type_conversion (int desires, tree expr, bool complain) break; default: + /* A wildcard could be instantiated to match any desired + type, but we can't deduce the template argument. */ + if (WILDCARD_TYPE_P (candidate)) + win = true; break; } if (win) { + if (TREE_CODE (cand) == TEMPLATE_DECL) + { + if (complain) + error ("default type conversion can't deduce template" + " argument for %qD", cand); + return error_mark_node; + } + if (winner) { if (complain) diff --git a/gcc/testsuite/g++.dg/template/delete2.C b/gcc/testsuite/g++.dg/template/delete2.C new file mode 100644 index 00000000000..b6ab380c9f9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/delete2.C @@ -0,0 +1,26 @@ +// PR c++/58119 + +template +struct A +{ + operator T*(); + template + operator A(); +}; + +template +struct B +{ + operator T*(); + template + operator A*(); +}; + +int main() +{ + A a; + delete a; + + B b; + delete b; // { dg-error "template|delete" } +} -- cgit v1.2.3 From d0f42ff40982f097e3a265580e2c17fd4812c1bf Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 21 Aug 2013 00:16:47 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201893 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index edd7430ef82..ceb104d6a4e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130820 +20130821 -- cgit v1.2.3 From f669e5a7b2790e4260042b9f162c9df34c84d2dc Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Wed, 21 Aug 2013 15:57:02 +0000 Subject: PR target/56979 * arm.c (aapcs_vfp_allocate): Decompose the argument if the suggested mode for the assignment isn't compatible with the registers required. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201903 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/arm/arm.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aea18a64aad..a1932917b22 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-21 Richard Earnshaw + + PR target/56979 + * arm.c (aapcs_vfp_allocate): Decompose the argument if the + suggested mode for the assignment isn't compatible with the + registers required. + 2013-08-20 Alan Modra PR target/57865 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index d76278bb531..ef92f880ecd 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -4459,7 +4459,9 @@ aapcs_vfp_allocate (CUMULATIVE_ARGS *pcum, enum machine_mode mode, if (((pcum->aapcs_vfp_regs_free >> regno) & mask) == mask) { pcum->aapcs_vfp_reg_alloc = mask << regno; - if (mode == BLKmode || (mode == TImode && !TARGET_NEON)) + if (mode == BLKmode + || (mode == TImode && ! TARGET_NEON) + || ! arm_hard_regno_mode_ok (FIRST_VFP_REGNUM + regno, mode)) { int i; int rcount = pcum->aapcs_vfp_rcount; -- cgit v1.2.3 From d558d64890111b6112e9706ef6ae067f275244ea Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 22 Aug 2013 00:16:17 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201912 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ceb104d6a4e..6fe2a8a0600 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130821 +20130822 -- cgit v1.2.3 From 8e4b3cfad620c9350f3c81eb7b0c0af41eab8c88 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 23 Aug 2013 00:16:47 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201931 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6fe2a8a0600..a370d32f95b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130822 +20130823 -- cgit v1.2.3 From 5279692b81dc439f4bdf953528eb3dbc55507d2b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Aug 2013 07:35:01 +0000 Subject: PR tree-optimization/58209 * tree-tailcall.c (find_tail_calls): Give up for pointer result types if m or a is non-NULL. * gcc.c-torture/execute/pr58209.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201937 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr58209.c | 32 +++++++++++++++++++++++++++ gcc/tree-tailcall.c | 5 +++++ 4 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58209.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1932917b22..d2760b5aede 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-08-23 Jakub Jelinek + + PR tree-optimization/58209 + * tree-tailcall.c (find_tail_calls): Give up for pointer result types + if m or a is non-NULL. + 2013-08-21 Richard Earnshaw PR target/56979 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8dac4942e78..e8d6aa1560f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-23 Jakub Jelinek + + PR tree-optimization/58209 + * gcc.c-torture/execute/pr58209.c: New test. + 2013-08-20 Paolo Carlini PR c++/58190 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58209.c b/gcc/testsuite/gcc.c-torture/execute/pr58209.c new file mode 100644 index 00000000000..78743bfb959 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58209.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/58209 */ + +extern void abort (void); +typedef __INTPTR_TYPE__ T; +T buf[1024]; + +T * +foo (T n) +{ + if (n == 0) + return (T *) buf; + T s = (T) foo (n - 1); + return (T *) (s + sizeof (T)); +} + +T * +bar (T n) +{ + if (n == 0) + return buf; + return foo (n - 1) + 1; +} + +int +main () +{ + int i; + for (i = 0; i < 27; i++) + if (foo (i) != buf + i || bar (i) != buf + i) + abort (); + return 0; +} diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index 350d707b235..b1b5f967325 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -574,6 +574,11 @@ find_tail_calls (basic_block bb, struct tailcall **ret) if (!tail_recursion && (m || a)) return; + /* For pointers don't allow additions or multiplications. */ + if ((m || a) + && POINTER_TYPE_P (TREE_TYPE (DECL_RESULT (current_function_decl)))) + return; + nw = XNEW (struct tailcall); nw->call_gsi = gsi; -- cgit v1.2.3 From 39576b88819179202dbdf04e4741cdcbfe42ca86 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Aug 2013 10:01:34 +0000 Subject: PR target/58218 * config/i386/x86-64.h (TARGET_SECTION_TYPE_FLAGS): Define. * config/i386/i386.c (x86_64_elf_section_type_flags): New function. * gcc.target/i386/pr58218.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201939 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.c | 22 ++++++++++++++++++++++ gcc/config/i386/x86-64.h | 3 +++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr58218.c | 5 +++++ 5 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr58218.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2760b5aede..52cd1e20a6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2013-08-23 Jakub Jelinek + PR target/58218 + * config/i386/x86-64.h (TARGET_SECTION_TYPE_FLAGS): Define. + * config/i386/i386.c (x86_64_elf_section_type_flags): New function. + PR tree-optimization/58209 * tree-tailcall.c (find_tail_calls): Give up for pointer result types if m or a is non-NULL. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 35cf1ef4a17..8475883823b 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4688,6 +4688,28 @@ x86_64_elf_select_section (tree decl, int reloc, return default_elf_select_section (decl, reloc, align); } +/* Select a set of attributes for section NAME based on the properties + of DECL and whether or not RELOC indicates that DECL's initializer + might contain runtime relocations. */ + +static unsigned int ATTRIBUTE_UNUSED +x86_64_elf_section_type_flags (tree decl, const char *name, int reloc) +{ + unsigned int flags = default_section_type_flags (decl, name, reloc); + + if (decl == NULL_TREE + && (strcmp (name, ".ldata.rel.ro") == 0 + || strcmp (name, ".ldata.rel.ro.local") == 0)) + flags |= SECTION_RELRO; + + if (strcmp (name, ".lbss") == 0 + || strncmp (name, ".lbss.", 5) == 0 + || strncmp (name, ".gnu.linkonce.lb.", 16) == 0) + flags |= SECTION_BSS; + + return flags; +} + /* Build up a unique section name, expressed as a STRING_CST node, and assign it to DECL_SECTION_NAME (decl). RELOC indicates whether the initial value of EXP requires diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h index c103c5865a3..66f96d98e2e 100644 --- a/gcc/config/i386/x86-64.h +++ b/gcc/config/i386/x86-64.h @@ -103,3 +103,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #undef TARGET_ASM_UNIQUE_SECTION #define TARGET_ASM_UNIQUE_SECTION x86_64_elf_unique_section + +#undef TARGET_SECTION_TYPE_FLAGS +#define TARGET_SECTION_TYPE_FLAGS x86_64_elf_section_type_flags diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8d6aa1560f..6d8365e4ba0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-08-23 Jakub Jelinek + PR target/58218 + * gcc.target/i386/pr58218.c: New test. + PR tree-optimization/58209 * gcc.c-torture/execute/pr58209.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pr58218.c b/gcc/testsuite/gcc.target/i386/pr58218.c new file mode 100644 index 00000000000..4145242059f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr58218.c @@ -0,0 +1,5 @@ +/* PR target/58218 */ +/* { dg-do assemble { target lp64 } } */ +/* { dg-options "-mcmodel=medium" } */ + +struct { float x[16385]; } a = { { 0.f, } }; -- cgit v1.2.3 From 50b06ce7afe13b7994e427b44a46c1cd65396fb3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 23 Aug 2013 21:04:55 +0000 Subject: compiler: don't export embedded builtins. The panic in test/fixedbugs/bug461.go was caused by the fact that reflect expects unexported fields in a struct to have a valid package path. If a struct field is an embedded built-in type, it is now given the package name of the currently compiling package, so it remains unexported for purposes of reflect. Fixed Issue 25. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201952 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/types.cc | 27 ++++++++++++++++++++++++--- gcc/go/gofrontend/types.h | 4 ++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 0a86d472062..b32c0587e6c 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -4221,6 +4221,22 @@ Struct_field::is_field_name(const std::string& name) const } } +// Return whether this field is an embedded built-in type. + +bool +Struct_field::is_embedded_builtin(Gogo* gogo) const +{ + const std::string& name(this->field_name()); + // We know that a field is an embedded type if it is anonymous. + // We can decide if it is a built-in type by checking to see if it is + // registered globally under the field's name. + // This allows us to distinguish between embedded built-in types and + // embedded types that are aliases to built-in types. + return (this->is_anonymous() + && !Gogo::is_hidden_name(name) + && gogo->lookup_global(name.c_str()) != NULL); +} + // Class Struct_type. // A hash table used to find identical unnamed structs so that they @@ -4835,11 +4851,16 @@ Struct_type::do_type_descriptor(Gogo* gogo, Named_type* name) ++q; go_assert(q->is_field_name("pkgPath")); - if (!Gogo::is_hidden_name(pf->field_name())) - fvals->push_back(Expression::make_nil(bloc)); + bool is_embedded_builtin = pf->is_embedded_builtin(gogo); + if (!Gogo::is_hidden_name(pf->field_name()) && !is_embedded_builtin) + fvals->push_back(Expression::make_nil(bloc)); else { - std::string n = Gogo::hidden_name_pkgpath(pf->field_name()); + std::string n; + if (is_embedded_builtin) + n = gogo->package_name(); + else + n = Gogo::hidden_name_pkgpath(pf->field_name()); Expression* s = Expression::make_string(n, bloc); fvals->push_back(Expression::make_unary(OPERATOR_AND, s, bloc)); } diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index 56626f1960e..8bc022eb824 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -1926,6 +1926,10 @@ class Struct_field bool is_field_name(const std::string& name) const; + // Return whether this struct field is an embedded built-in type. + bool + is_embedded_builtin(Gogo*) const; + // The field type. Type* type() const -- cgit v1.2.3 From 153b535eb17b3980c60b0158829c99f08bbb8222 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 24 Aug 2013 00:16:39 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201958 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a370d32f95b..9b95a669606 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130823 +20130824 -- cgit v1.2.3 From 1bf5728889e90479a4c8e744535bbfb0dffcb38b Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sat, 24 Aug 2013 09:12:21 +0000 Subject: 2013-08-24 Janus Weil Backport from trunk: 2013-08-22 Janus Weil PR fortran/58185 * match.c (copy_ts_from_selector_to_associate): Only build class container for polymorphic selector. Some cleanup. 2013-08-24 Janus Weil Backport from trunk: 2013-08-22 Janus Weil PR fortran/58185 * gfortran.dg/select_type_34.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201964 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 ++++++ gcc/fortran/match.c | 42 ++++++++-------------------- gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gfortran.dg/select_type_34.f90 | 10 +++++++ 4 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/select_type_34.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index be2afaa869d..759cac57f6a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2013-08-24 Janus Weil + + Backport from trunk: + 2013-08-22 Janus Weil + + PR fortran/58185 + * match.c (copy_ts_from_selector_to_associate): Only build class + container for polymorphic selector. Some cleanup. + 2013-08-11 Janus Weil Backport from trunk: diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index e9a701bb608..a320248fe3e 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -5142,7 +5142,6 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) { gfc_ref *ref; gfc_symbol *assoc_sym; - int i; assoc_sym = associate->symtree->n.sym; @@ -5153,9 +5152,8 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) while (ref && ref->next) ref = ref->next; - if (selector->ts.type == BT_CLASS - && CLASS_DATA (selector)->as - && ref && ref->type == REF_ARRAY) + if (selector->ts.type == BT_CLASS && CLASS_DATA (selector)->as + && ref && ref->type == REF_ARRAY) { /* Ensure that the array reference type is set. We cannot use gfc_resolve_expr at this point, so the usable parts of @@ -5163,7 +5161,7 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) if (ref->u.ar.type == AR_UNKNOWN) { ref->u.ar.type = AR_ELEMENT; - for (i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++) + for (int i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++) if (ref->u.ar.dimen_type[i] == DIMEN_RANGE || ref->u.ar.dimen_type[i] == DIMEN_VECTOR || (ref->u.ar.dimen_type[i] == DIMEN_UNKNOWN @@ -5182,37 +5180,19 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) selector->rank = 0; } - if (selector->ts.type != BT_CLASS) + if (selector->rank) { - /* The correct class container has to be available. */ - if (selector->rank) - { - assoc_sym->attr.dimension = 1; - assoc_sym->as = gfc_get_array_spec (); - assoc_sym->as->rank = selector->rank; - assoc_sym->as->type = AS_DEFERRED; - } - else - assoc_sym->as = NULL; - - assoc_sym->ts.type = BT_CLASS; - assoc_sym->ts.u.derived = selector->ts.u.derived; - assoc_sym->attr.pointer = 1; - gfc_build_class_symbol (&assoc_sym->ts, &assoc_sym->attr, - &assoc_sym->as, false); + assoc_sym->attr.dimension = 1; + assoc_sym->as = gfc_get_array_spec (); + assoc_sym->as->rank = selector->rank; + assoc_sym->as->type = AS_DEFERRED; } else + assoc_sym->as = NULL; + + if (selector->ts.type == BT_CLASS) { /* The correct class container has to be available. */ - if (selector->rank) - { - assoc_sym->attr.dimension = 1; - assoc_sym->as = gfc_get_array_spec (); - assoc_sym->as->rank = selector->rank; - assoc_sym->as->type = AS_DEFERRED; - } - else - assoc_sym->as = NULL; assoc_sym->ts.type = BT_CLASS; assoc_sym->ts.u.derived = CLASS_DATA (selector)->ts.u.derived; assoc_sym->attr.pointer = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6d8365e4ba0..a195497b023 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-24 Janus Weil + + Backport from trunk: + 2013-08-22 Janus Weil + + PR fortran/58185 + * gfortran.dg/select_type_34.f90: New. + 2013-08-23 Jakub Jelinek PR target/58218 diff --git a/gcc/testsuite/gfortran.dg/select_type_34.f90 b/gcc/testsuite/gfortran.dg/select_type_34.f90 new file mode 100644 index 00000000000..e75a7abd56e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/select_type_34.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! +! PR 58185: [4.8/4.9 Regression] [OOP] ICE when selector in SELECT TYPE is non-polymorphic +! +! Contributed by John + + integer :: array + select type (a => array) ! { dg-error "Selector shall be polymorphic" } + end select +end -- cgit v1.2.3 From 3a5d76675d5817c2da21d5bdecaf45f806a7b7ee Mon Sep 17 00:00:00 2001 From: Mikael Morin Date: Sat, 24 Aug 2013 09:54:59 +0000 Subject: fortran/ * trans-array.c (gfc_conv_section_startstride): Move &loop->pre access to the callers. (gfc_conv_ss_startstride, gfc_conv_expr_descriptor): Update callers. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201965 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-array.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 759cac57f6a..f539bd70d34 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-08-24 Mikael Morin + + * trans-array.c (gfc_conv_section_startstride): Move &loop->pre access + to the callers. + (gfc_conv_ss_startstride, gfc_conv_expr_descriptor): Update callers. + 2013-08-24 Janus Weil Backport from trunk: diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 75fed2f651c..7cac2977b27 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3674,7 +3674,7 @@ evaluate_bound (stmtblock_t *block, tree *bounds, gfc_expr ** values, /* Calculate the lower bound of an array section. */ static void -gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int dim) +gfc_conv_section_startstride (stmtblock_t * block, gfc_ss * ss, int dim) { gfc_expr *stride = NULL; tree desc; @@ -3703,12 +3703,12 @@ gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int dim) /* Calculate the start of the range. For vector subscripts this will be the range of the vector. */ - evaluate_bound (&loop->pre, info->start, ar->start, desc, dim, true); + evaluate_bound (block, info->start, ar->start, desc, dim, true); /* Similarly calculate the end. Although this is not used in the scalarizer, it is needed when checking bounds and where the end is an expression with side-effects. */ - evaluate_bound (&loop->pre, info->end, ar->end, desc, dim, false); + evaluate_bound (block, info->end, ar->end, desc, dim, false); /* Calculate the stride. */ if (stride == NULL) @@ -3717,8 +3717,8 @@ gfc_conv_section_startstride (gfc_loopinfo * loop, gfc_ss * ss, int dim) { gfc_init_se (&se, NULL); gfc_conv_expr_type (&se, stride, gfc_array_index_type); - gfc_add_block_to_block (&loop->pre, &se.pre); - info->stride[dim] = gfc_evaluate_now (se.expr, &loop->pre); + gfc_add_block_to_block (block, &se.pre); + info->stride[dim] = gfc_evaluate_now (se.expr, block); } } @@ -3797,7 +3797,7 @@ done: gfc_conv_ss_descriptor (&loop->pre, ss, !loop->array_parameter); for (n = 0; n < ss->dimen; n++) - gfc_conv_section_startstride (loop, ss, ss->dim[n]); + gfc_conv_section_startstride (&loop->pre, ss, ss->dim[n]); break; case GFC_SS_INTRINSIC: @@ -6690,10 +6690,10 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) gcc_assert (ar->dimen_type[n + ndim] == DIMEN_THIS_IMAGE); /* Make sure the call to gfc_conv_section_startstride won't - generate unnecessary code to calculate stride. */ + generate unnecessary code to calculate stride. */ gcc_assert (ar->stride[n + ndim] == NULL); - gfc_conv_section_startstride (&loop, ss, n + ndim); + gfc_conv_section_startstride (&loop.pre, ss, n + ndim); loop.from[n + loop.dimen] = info->start[n + ndim]; loop.to[n + loop.dimen] = info->end[n + ndim]; } -- cgit v1.2.3 From f40e350560044269bdd4e94f330b237f4d652f0e Mon Sep 17 00:00:00 2001 From: Mikael Morin Date: Sat, 24 Aug 2013 12:46:17 +0000 Subject: fortran/ PR fortran/57798 * trans-array.c (gfc_conv_ss_startstride, set_loop_bounds, gfc_set_delta): Generate preliminary code before the outermost loop. testsuite/ PR fortran/57798 * gfortran.dg/inline_sum_5.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201966 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-array.c | 21 ++++++++++++------- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/inline_sum_5.f90 | 33 ++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/inline_sum_5.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f539bd70d34..d3a136fe8b5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-08-24 Mikael Morin + + PR fortran/57798 + * trans-array.c (gfc_conv_ss_startstride, set_loop_bounds, + gfc_set_delta): Generate preliminary code before the outermost loop. + 2013-08-24 Mikael Morin * trans-array.c (gfc_conv_section_startstride): Move &loop->pre access diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 7cac2977b27..b34f6fb19a6 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3735,6 +3735,8 @@ gfc_conv_ss_startstride (gfc_loopinfo * loop) gfc_ss *ss; tree desc; + gfc_loopinfo * const outer_loop = outermost_loop (loop); + loop->dimen = 0; /* Determine the rank of the loop. */ for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain) @@ -3794,10 +3796,11 @@ done: /* Get the descriptor for the array. If it is a cross loops array, we got the descriptor already in the outermost loop. */ if (ss->parent == NULL) - gfc_conv_ss_descriptor (&loop->pre, ss, !loop->array_parameter); + gfc_conv_ss_descriptor (&outer_loop->pre, ss, + !loop->array_parameter); for (n = 0; n < ss->dimen; n++) - gfc_conv_section_startstride (&loop->pre, ss, ss->dim[n]); + gfc_conv_section_startstride (&outer_loop->pre, ss, ss->dim[n]); break; case GFC_SS_INTRINSIC: @@ -3833,7 +3836,7 @@ done: fold_convert (gfc_array_index_type, rank), gfc_index_one_node); - info->end[0] = gfc_evaluate_now (tmp, &loop->pre); + info->end[0] = gfc_evaluate_now (tmp, &outer_loop->pre); info->start[0] = gfc_index_zero_node; info->stride[0] = gfc_index_one_node; continue; @@ -4115,7 +4118,7 @@ done: } tmp = gfc_finish_block (&block); - gfc_add_expr_to_block (&loop->pre, tmp); + gfc_add_expr_to_block (&outer_loop->pre, tmp); } for (loop = loop->nested; loop; loop = loop->next) @@ -4398,6 +4401,8 @@ set_loop_bounds (gfc_loopinfo *loop) mpz_t i; bool nonoptional_arr; + gfc_loopinfo * const outer_loop = outermost_loop (loop); + loopspec = loop->specloop; mpz_init (i); @@ -4583,7 +4588,7 @@ set_loop_bounds (gfc_loopinfo *loop) else { /* Set the delta for this section. */ - info->delta[dim] = gfc_evaluate_now (loop->from[n], &loop->pre); + info->delta[dim] = gfc_evaluate_now (loop->from[n], &outer_loop->pre); /* Number of iterations is (end - start + step) / step. with start = 0, this simplifies to last = end / step; @@ -4595,7 +4600,7 @@ set_loop_bounds (gfc_loopinfo *loop) gfc_array_index_type, tmp, info->stride[dim]); tmp = fold_build2_loc (input_location, MAX_EXPR, gfc_array_index_type, tmp, build_int_cst (gfc_array_index_type, -1)); - loop->to[n] = gfc_evaluate_now (tmp, &loop->pre); + loop->to[n] = gfc_evaluate_now (tmp, &outer_loop->pre); /* Make the loop variable start at 0. */ loop->from[n] = gfc_index_zero_node; } @@ -4671,6 +4676,8 @@ gfc_set_delta (gfc_loopinfo *loop) tree tmp; int n, dim; + gfc_loopinfo * const outer_loop = outermost_loop (loop); + loopspec = loop->specloop; /* Calculate the translation from loop variables to array indices. */ @@ -4706,7 +4713,7 @@ gfc_set_delta (gfc_loopinfo *loop) gfc_array_index_type, info->start[dim], tmp); - info->delta[dim] = gfc_evaluate_now (tmp, &loop->pre); + info->delta[dim] = gfc_evaluate_now (tmp, &outer_loop->pre); } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a195497b023..332aa088e01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-24 Mikael Morin + + PR fortran/57798 + * gfortran.dg/inline_sum_5.f90: New. + 2013-08-24 Janus Weil Backport from trunk: diff --git a/gcc/testsuite/gfortran.dg/inline_sum_5.f90 b/gcc/testsuite/gfortran.dg/inline_sum_5.f90 new file mode 100644 index 00000000000..bda73fd99a3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/inline_sum_5.f90 @@ -0,0 +1,33 @@ +! { dg-do run } +! +! PR fortran/57798 +! The call to sum used to be inlined into a loop with an uninitialized bound +! +! Original testcase by Stephan Kramer + +program test + implicit none + + call sub(2, 11) + + contains + + function func(m, n) + integer, intent(in):: m,n + real, dimension(m, n):: func + + func = 1.0 + + end function func + + subroutine sub(m, n) + integer, intent(in):: m, n + real, dimension(m,n):: y + + y = 1.0 + if (any(sum(y*func(m,n), dim=1) /= m)) call abort + + end subroutine sub + +end program test + -- cgit v1.2.3 From 6462dc5a2aab03e222f33a81addba8963d7b875e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 25 Aug 2013 00:16:37 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201971 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9b95a669606..8c27bf72aba 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130824 +20130825 -- cgit v1.2.3 From 809ce4821011dae72089854dea5a8b56b39e0518 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 26 Aug 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@201983 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8c27bf72aba..5153c631103 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130825 +20130826 -- cgit v1.2.3 From 10967f1942de82f70c5dbf3c0338076a02b29c32 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 27 Aug 2013 00:16:51 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202012 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5153c631103..6733c07f773 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130826 +20130827 -- cgit v1.2.3 From a265ebeb3d0582e8a63a1eb7e6979f2571e9f884 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 28 Aug 2013 00:16:35 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202038 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6733c07f773..db30cf8670f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130827 +20130828 -- cgit v1.2.3 From 89cddc4bccb6724b732029591f2b098d947965bf Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 28 Aug 2013 08:25:13 +0000 Subject: Backport from mainline 2013-08-27 H.J. Lu * config/i386/driver-i386.c (host_detect_local_cpu): Update Haswell processor detection. Backport from mainline 2013-08-27 Christian Widmer PR target/57927 * config/i386/driver-i386.c (host_detect_local_cpu): Add detection of Ivy Bridge and Haswell processors. Assume core-avx2 for unknown AVX2 capable processors. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202045 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 20 ++++++++++++++++++-- gcc/config/i386/driver-i386.c | 30 ++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 52cd1e20a6b..c6429a9e918 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2013-08-28 Uros Bizjak + + Backport from mainline + 2013-08-27 H.J. Lu + + * config/i386/driver-i386.c (host_detect_local_cpu): Update + Haswell processor detection. + + Backport from mainline + 2013-08-27 Christian Widmer + + PR target/57927 + * config/i386/driver-i386.c (host_detect_local_cpu): Add detection + of Ivy Bridge and Haswell processors. Assume core-avx2 for unknown + AVX2 capable processors. + 2013-08-23 Jakub Jelinek PR target/58218 @@ -25,8 +41,8 @@ Jakub Jelinek Backport from mainline - * config/rs6000/dfp.md (*negtd2_fpr): Handle non-overlapping destination - and source operands. + * config/rs6000/dfp.md (*negtd2_fpr): Handle non-overlapping + destination and source operands. 2013-08-18 Jakub Jelinek diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 55c389a16ee..76375849556 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -638,13 +638,18 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* Atom. */ cpu = "atom"; break; + case 0x0f: + /* Merom. */ + case 0x17: + case 0x1d: + /* Penryn. */ + cpu = "core2"; + break; case 0x1a: case 0x1e: case 0x1f: case 0x2e: /* Nehalem. */ - cpu = "corei7"; - break; case 0x25: case 0x2c: case 0x2f: @@ -656,20 +661,25 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* Sandy Bridge. */ cpu = "corei7-avx"; break; - case 0x17: - case 0x1d: - /* Penryn. */ - cpu = "core2"; + case 0x3a: + case 0x3e: + /* Ivy Bridge. */ + cpu = "core-avx-i"; break; - case 0x0f: - /* Merom. */ - cpu = "core2"; + case 0x3c: + case 0x45: + case 0x46: + /* Haswell. */ + cpu = "core-avx2"; break; default: if (arch) { /* This is unknown family 0x6 CPU. */ - if (has_avx) + if (has_avx2) + /* Assume Haswell. */ + cpu = "core-avx2"; + else if (has_avx) /* Assume Sandy Bridge. */ cpu = "corei7-avx"; else if (has_sse4_2) -- cgit v1.2.3 From 7567a3c36ddc7d403f38385546634ab724a96c6d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 28 Aug 2013 08:29:48 +0000 Subject: 2013-08-28 Richard Biener Backport from mainline 2013-06-24 Richard Biener PR middle-end/56977 * passes.c (init_optimization_passes): Move pass_fold_builtins and pass_dce earlier with -Og. * gcc.dg/pr56977.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202046 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/passes.c | 8 ++++---- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pr56977.c | 10 ++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr56977.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6429a9e918..9beb893bb87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-28 Richard Biener + + Backport from mainline + 2013-06-24 Richard Biener + + PR middle-end/56977 + * passes.c (init_optimization_passes): Move pass_fold_builtins + and pass_dce earlier with -Og. + 2013-08-28 Uros Bizjak Backport from mainline diff --git a/gcc/passes.c b/gcc/passes.c index 8390223e88e..7085f5d247f 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1531,15 +1531,15 @@ init_optimization_passes (void) /* Perform simple scalar cleanup which is constant/copy propagation. */ NEXT_PASS (pass_ccp); NEXT_PASS (pass_object_sizes); + /* Fold remaining builtins. */ + NEXT_PASS (pass_fold_builtins); /* Copy propagation also copy-propagates constants, this is necessary - to forward object-size results properly. */ + to forward object-size and builtin folding results properly. */ NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_dce); NEXT_PASS (pass_asan); NEXT_PASS (pass_tsan); NEXT_PASS (pass_rename_ssa_copies); - NEXT_PASS (pass_dce); - /* Fold remaining builtins. */ - NEXT_PASS (pass_fold_builtins); /* ??? We do want some kind of loop invariant motion, but we possibly need to adjust LIM to be more friendly towards preserving accurate debug information here. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 332aa088e01..2c4b075ce27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-28 Richard Biener + + Backport from mainline + 2013-06-24 Richard Biener + + PR middle-end/56977 + * gcc.dg/pr56977.c: New testcase. + 2013-08-24 Mikael Morin PR fortran/57798 diff --git a/gcc/testsuite/gcc.dg/pr56977.c b/gcc/testsuite/gcc.dg/pr56977.c new file mode 100644 index 00000000000..fde88afed1d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56977.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Og" } */ + +__attribute__((__error__("error"))) void error (); + +void f (int i) { + if (__builtin_constant_p (i)) { + error (); + } +} -- cgit v1.2.3 From 27ffe53bf2e798c0cd50771c0645bce65c7bd6cd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 28 Aug 2013 10:10:43 +0000 Subject: PR middle-end/58257 * omp-low.c (copy_var_decl): Copy over TREE_NO_WARNING flag. * c-c++-common/gomp/pr58257.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202050 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/omp-low.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/c-c++-common/gomp/pr58257.c | 15 +++++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr58257.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9beb893bb87..4c5ff4b267d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-08-28 Jakub Jelinek + + PR middle-end/58257 + * omp-low.c (copy_var_decl): Copy over TREE_NO_WARNING flag. + 2013-08-28 Richard Biener Backport from mainline diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 7440bef22b0..354d30ad0a2 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -836,6 +836,7 @@ copy_var_decl (tree var, tree name, tree type) DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var); DECL_IGNORED_P (copy) = DECL_IGNORED_P (var); DECL_CONTEXT (copy) = DECL_CONTEXT (var); + TREE_NO_WARNING (copy) = TREE_NO_WARNING (var); TREE_USED (copy) = 1; DECL_SEEN_IN_BIND_EXPR_P (copy) = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c4b075ce27..c319a5e1e9d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-28 Jakub Jelinek + + PR middle-end/58257 + * c-c++-common/gomp/pr58257.c: New test. + 2013-08-28 Richard Biener Backport from mainline diff --git a/gcc/testsuite/c-c++-common/gomp/pr58257.c b/gcc/testsuite/c-c++-common/gomp/pr58257.c new file mode 100644 index 00000000000..8f8d24a998a --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr58257.c @@ -0,0 +1,15 @@ +/* PR middle-end/58257 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -Wall" } */ + +int +foo (int n) +{ + int a[10][10]; + int x, y; +#pragma omp parallel for collapse(2) /* { dg-bogus "may be used uninitialized in this function" } */ + for (x = 0; x < n; x++) /* { dg-bogus "may be used uninitialized in this function" } */ + for (y = 0; y < n; y++) + a[x][y] = x + y * y; + return a[0][0]; +} -- cgit v1.2.3 From 1d488c180bac92a9980510e24f04f93f046457fa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 29 Aug 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202063 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index db30cf8670f..c1110c20e13 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130828 +20130829 -- cgit v1.2.3 From 0bd2cdb466f4f61255c77561c48439f680a3ac67 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 29 Aug 2013 00:49:47 +0000 Subject: * go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if the struct is not hidden. (Gcc_backend::immutable_struct_set_init): Don't set TREE_PUBLIC. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202066 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 6 ++++++ gcc/go/go-gcc.cc | 16 ++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 3e77c2929b5..7edfb604686 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2013-08-28 Ian Lance Taylor + + * go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if + the struct is not hidden. + (Gcc_backend::immutable_struct_set_init): Don't set TREE_PUBLIC. + 2013-08-06 Ian Lance Taylor * go-gcc.cc (Gcc_backend::immutable_struct_set_init): Use diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 1ecfaffd73a..025bb2bdca0 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1475,8 +1475,8 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, // Create a named immutable initialized data structure. Bvariable* -Gcc_backend::immutable_struct(const std::string& name, bool, bool, - Btype* btype, Location location) +Gcc_backend::immutable_struct(const std::string& name, bool is_hidden, + bool, Btype* btype, Location location) { tree type_tree = btype->get_tree(); if (type_tree == error_mark_node) @@ -1490,6 +1490,8 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool, TREE_CONSTANT(decl) = 1; TREE_USED(decl) = 1; DECL_ARTIFICIAL(decl) = 1; + if (!is_hidden) + TREE_PUBLIC(decl) = 1; // We don't call rest_of_decl_compilation until we have the // initializer. @@ -1503,8 +1505,7 @@ Gcc_backend::immutable_struct(const std::string& name, bool, bool, void Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, - bool is_hidden, bool is_common, Btype*, - Location, + bool, bool is_common, Btype*, Location, Bexpression* initializer) { tree decl = var->get_tree(); @@ -1515,12 +1516,7 @@ Gcc_backend::immutable_struct_set_init(Bvariable* var, const std::string&, DECL_INITIAL(decl) = init_tree; // We can't call make_decl_one_only until we set DECL_INITIAL. - if (!is_common) - { - if (!is_hidden) - TREE_PUBLIC(decl) = 1; - } - else + if (is_common) make_decl_one_only(decl, DECL_ASSEMBLER_NAME(decl)); // These variables are often unneeded in the final program, so put -- cgit v1.2.3 From 9c0b580b05c94aa1a51928e6ae4806bc926de16d Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Aug 2013 13:09:26 +0000 Subject: Backported from mainline 2013-05-27 Richard Biener PR tree-optimization/57343 * tree-ssa-loop-niter.c (number_of_iterations_ne_max): Do not use multiple_of_p if not TYPE_OVERFLOW_UNDEFINED. (number_of_iterations_cond): Do not build the folded tree. * gcc.dg/torture/pr57343.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202072 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr57343.c | 22 ++++++++++++++++++++++ gcc/tree-ssa-loop-niter.c | 20 ++++++++++++++------ 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57343.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4c5ff4b267d..65ed33a6227 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-08-29 Jakub Jelinek + + Backported from mainline + 2013-05-27 Richard Biener + + PR tree-optimization/57343 + * tree-ssa-loop-niter.c (number_of_iterations_ne_max): Do not + use multiple_of_p if not TYPE_OVERFLOW_UNDEFINED. + (number_of_iterations_cond): Do not build the folded tree. + 2013-08-28 Jakub Jelinek PR middle-end/58257 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c319a5e1e9d..2b3cca6592e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-08-29 Jakub Jelinek + + Backported from mainline + 2013-05-27 Richard Biener + + PR tree-optimization/57343 + * gcc.dg/torture/pr57343.c: New testcase. + 2013-08-28 Jakub Jelinek PR middle-end/58257 diff --git a/gcc/testsuite/gcc.dg/torture/pr57343.c b/gcc/testsuite/gcc.dg/torture/pr57343.c new file mode 100644 index 00000000000..b05bad5cb43 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57343.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +int c = 0; + +int +main () +{ + int i, f = 1; + for (i = 0; i < 5; i++) + { + --c; + unsigned char h = c * 100; + if (h == 0) + { + f = 0; + break; + } + } + if (f != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 090e114c36d..f5629306e4b 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -552,10 +552,18 @@ number_of_iterations_ne_max (mpz_t bnd, bool no_overflow, tree c, tree s, { double_int max; mpz_t d; + tree type = TREE_TYPE (c); bool bnds_u_valid = ((no_overflow && exit_must_be_taken) || mpz_sgn (bnds->below) >= 0); - if (multiple_of_p (TREE_TYPE (c), c, s)) + if (integer_onep (s) + || (TREE_CODE (c) == INTEGER_CST + && TREE_CODE (s) == INTEGER_CST + && tree_to_double_int (c).mod (tree_to_double_int (s), + TYPE_UNSIGNED (type), + EXACT_DIV_EXPR).is_zero ()) + || (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (c)) + && multiple_of_p (type, c, s))) { /* If C is an exact multiple of S, then its value will be reached before the induction variable overflows (unless the loop is exited in some @@ -572,16 +580,15 @@ number_of_iterations_ne_max (mpz_t bnd, bool no_overflow, tree c, tree s, the whole # of iterations analysis will fail). */ if (!no_overflow) { - max = double_int::mask (TYPE_PRECISION (TREE_TYPE (c)) - - tree_low_cst (num_ending_zeros (s), 1)); + max = double_int::mask (TYPE_PRECISION (type) + - tree_low_cst (num_ending_zeros (s), 1)); mpz_set_double_int (bnd, max, true); return; } /* Now we know that the induction variable does not overflow, so the loop iterates at most (range of type / S) times. */ - mpz_set_double_int (bnd, double_int::mask (TYPE_PRECISION (TREE_TYPE (c))), - true); + mpz_set_double_int (bnd, double_int::mask (TYPE_PRECISION (type)), true); /* If the induction variable is guaranteed to reach the value of C before overflow, ... */ @@ -1311,7 +1318,8 @@ number_of_iterations_cond (struct loop *loop, } /* If the loop exits immediately, there is nothing to do. */ - if (integer_zerop (fold_build2 (code, boolean_type_node, iv0->base, iv1->base))) + tree tem = fold_binary (code, boolean_type_node, iv0->base, iv1->base); + if (tem && integer_zerop (tem)) { niter->niter = build_int_cst (unsigned_type_for (type), 0); niter->max = double_int_zero; -- cgit v1.2.3 From fc06b39f6f857bc5517ee94f9a95a0ab73cd208b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 29 Aug 2013 13:11:01 +0000 Subject: Backported from mainline 2013-05-27 Richard Biener PR tree-optimization/57396 * tree-affine.c (double_int_constant_multiple_p): Properly return false for val == 0 and div != 0. * gfortran.fortran-torture/execute/pr57396.f90: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202073 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 +++ gcc/testsuite/ChangeLog | 3 ++ .../gfortran.fortran-torture/execute/pr57396.f90 | 33 ++++++++++++++++++++++ gcc/tree-affine.c | 17 +++++++---- 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.fortran-torture/execute/pr57396.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65ed33a6227..9645455a8a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Backported from mainline 2013-05-27 Richard Biener + PR tree-optimization/57396 + * tree-affine.c (double_int_constant_multiple_p): Properly + return false for val == 0 and div != 0. + PR tree-optimization/57343 * tree-ssa-loop-niter.c (number_of_iterations_ne_max): Do not use multiple_of_p if not TYPE_OVERFLOW_UNDEFINED. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b3cca6592e..b013e4e9981 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -3,6 +3,9 @@ Backported from mainline 2013-05-27 Richard Biener + PR tree-optimization/57396 + * gfortran.fortran-torture/execute/pr57396.f90: New testcase. + PR tree-optimization/57343 * gcc.dg/torture/pr57343.c: New testcase. diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/pr57396.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/pr57396.f90 new file mode 100644 index 00000000000..8ea92924ad8 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/pr57396.f90 @@ -0,0 +1,33 @@ +module testmod + implicit none + + contains + + subroutine foo(n) + integer, intent(in) :: n + real :: r(0:n,-n:n), a(0:n,-n:n), dj + integer :: k, j + + ! initialize with some dummy values + do j = -n, n + a(:, j) = j + r(:,j) = j + 1 + end do + + ! here be dragons + do k = 0, n + dj = r(k, k - 2) * a(k, k - 2) + r(k,k) = a(k, k - 1) * dj + enddo + + if (r(0,0) .ne. -2.) call abort + + end subroutine + +end module + +program test + use testmod + implicit none + call foo(5) +end program diff --git a/gcc/tree-affine.c b/gcc/tree-affine.c index 0ee5eaa9db6..46a183a07b4 100644 --- a/gcc/tree-affine.c +++ b/gcc/tree-affine.c @@ -736,11 +736,10 @@ free_affine_expand_cache (struct pointer_map_t **cache) } /* If VAL != CST * DIV for any constant CST, returns false. - Otherwise, if VAL != 0 (and hence CST != 0), and *MULT_SET is true, - additionally compares CST and MULT, and if they are different, - returns false. Finally, if neither of these two cases occur, - true is returned, and if CST != 0, CST is stored to MULT and - MULT_SET is set to true. */ + Otherwise, if *MULT_SET is true, additionally compares CST and MULT, + and if they are different, returns false. Finally, if neither of these + two cases occur, true is returned, and CST is stored to MULT and MULT_SET + is set to true. */ static bool double_int_constant_multiple_p (double_int val, double_int div, @@ -749,7 +748,13 @@ double_int_constant_multiple_p (double_int val, double_int div, double_int rem, cst; if (val.is_zero ()) - return true; + { + if (*mult_set && !mult->is_zero ()) + return false; + *mult_set = true; + *mult = double_int_zero; + return true; + } if (div.is_zero ()) return false; -- cgit v1.2.3 From 1077d3cd77808cf7c4d4f3f42b514d10d5126dd7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Aug 2013 13:14:59 +0000 Subject: Backported from mainline 2013-07-22 Georg-Johann Lay PR testsuite/52641 * gcc.dg/torture/pr57381.c: Add dg-require-effective-target int32plus. 2013-05-27 Richard Biener PR middle-end/57381 PR tree-optimization/57417 * tree-ssa-sccvn.c (vn_reference_fold_indirect): Fix test for unchanged base. (set_ssa_val_to): Compare addresses using get_addr_base_and_unit_offset. PR tree-optimization/57417 * gcc.dg/torture/pr57417.c: New testcase. 2013-05-23 Richard Biener PR middle-end/57381 * gcc.dg/torture/pr57381.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202074 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 13 +++++++++++++ gcc/testsuite/gcc.dg/torture/pr57381.c | 25 +++++++++++++++++++++++++ gcc/testsuite/gcc.dg/torture/pr57417.c | 12 ++++++++++++ gcc/tree-ssa-sccvn.c | 15 +++++++++++++-- 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57381.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr57417.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9645455a8a8..44c9c9f6790 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,13 @@ Backported from mainline 2013-05-27 Richard Biener + PR middle-end/57381 + PR tree-optimization/57417 + * tree-ssa-sccvn.c (vn_reference_fold_indirect): Fix test + for unchanged base. + (set_ssa_val_to): Compare addresses using + get_addr_base_and_unit_offset. + PR tree-optimization/57396 * tree-affine.c (double_int_constant_multiple_p): Properly return false for val == 0 and div != 0. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b013e4e9981..d4e9f2d7939 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,14 +1,27 @@ 2013-08-29 Jakub Jelinek Backported from mainline + 2013-07-22 Georg-Johann Lay + + PR testsuite/52641 + * gcc.dg/torture/pr57381.c: Add dg-require-effective-target int32plus. + 2013-05-27 Richard Biener + PR tree-optimization/57417 + * gcc.dg/torture/pr57417.c: New testcase. + PR tree-optimization/57396 * gfortran.fortran-torture/execute/pr57396.f90: New testcase. PR tree-optimization/57343 * gcc.dg/torture/pr57343.c: New testcase. + 2013-05-23 Richard Biener + + PR middle-end/57381 + * gcc.dg/torture/pr57381.c: New testcase. + 2013-08-28 Jakub Jelinek PR middle-end/58257 diff --git a/gcc/testsuite/gcc.dg/torture/pr57381.c b/gcc/testsuite/gcc.dg/torture/pr57381.c new file mode 100644 index 00000000000..ff6550a6d5f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57381.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target int32plus } */ + +struct S0 { int f0, f1, f2; }; + +struct S1 { + int f0; + volatile struct S0 f2; +}; + +static struct S1 s = {0x47BED265,{0x06D4EB3E,5,0U}}; + +int foo(struct S0 p) +{ + for (s.f2.f2 = 0; (s.f2.f2 <= 12); s.f2.f2++) + { + volatile int *l_61[5][2][2] = {{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,(void*)0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{&s.f2.f0,&s.f2.f0}},{{&s.f2.f0,&s.f2.f0},{(void*)0,&s.f2.f0}}}; + + volatile int **l_68 = &l_61[0][0][1]; + volatile int *l_76 = &s.f2.f0; + (*l_68) = l_61[0][0][0]; + if ((*l_76 = (p.f2 % 5))) ; + } + return p.f0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr57417.c b/gcc/testsuite/gcc.dg/torture/pr57417.c new file mode 100644 index 00000000000..6eac6f932b8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57417.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +int a, b; +volatile int *c; + +void foo () +{ + volatile int d[1]; + b = 0; + for (;; a--) + c = &d[b]; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 58fe903e74f..016a5d1bad3 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1062,7 +1062,7 @@ vn_reference_fold_indirect (vec *ops, addr_base = get_addr_base_and_unit_offset (TREE_OPERAND (op->op0, 0), &addr_offset); gcc_checking_assert (addr_base && TREE_CODE (addr_base) != MEM_REF); - if (addr_base != op->op0) + if (addr_base != TREE_OPERAND (op->op0, 0)) { double_int off = tree_to_double_int (mem_op->op0); off = off.sext (TYPE_PRECISION (TREE_TYPE (mem_op->op0))); @@ -2555,6 +2555,7 @@ static inline bool set_ssa_val_to (tree from, tree to) { tree currval = SSA_VAL (from); + HOST_WIDE_INT toff, coff; if (from != to) { @@ -2590,7 +2591,17 @@ set_ssa_val_to (tree from, tree to) print_generic_expr (dump_file, to, 0); } - if (currval != to && !operand_equal_p (currval, to, OEP_PURE_SAME)) + if (currval != to + && !operand_equal_p (currval, to, 0) + /* ??? For addresses involving volatile objects or types operand_equal_p + does not reliably detect ADDR_EXPRs as equal. We know we are only + getting invariant gimple addresses here, so can use + get_addr_base_and_unit_offset to do this comparison. */ + && !(TREE_CODE (currval) == ADDR_EXPR + && TREE_CODE (to) == ADDR_EXPR + && (get_addr_base_and_unit_offset (TREE_OPERAND (currval, 0), &coff) + == get_addr_base_and_unit_offset (TREE_OPERAND (to, 0), &toff)) + && coff == toff)) { VN_INFO (from)->valnum = to; if (dump_file && (dump_flags & TDF_DETAILS)) -- cgit v1.2.3 From 25629c8e0256a460f5eff6dbd7bc14d6c130f6aa Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Thu, 29 Aug 2013 18:37:46 +0000 Subject: Backport from mainline 2013-08-05 Oleg Endo PR other/12081 * recog.h (rtx (*insn_gen_fn) (rtx, ...)): Replace typedef with new class insn_gen_fn. * expr.c (move_by_pieces_1, store_by_pieces_2): Replace argument rtx (*) (rtx, ...) with insn_gen_fn. * genoutput.c (output_insn_data): Cast gen_? function pointers to insn_gen_fn::stored_funcptr. Add initializer braces. Backport from mainline 2013-08-07 Oleg Endo PR other/12081 * config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef. (rs6000_emit_swdiv_high_precision, rs6000_emit_swdiv_low_precision, rs6000_emit_swrsqrt): Don't cast result of GEN_FCN to gen_2arg_fn_t. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202083 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 +++++++++++++++++++ gcc/config/rs6000/rs6000.c | 9 +++----- gcc/expr.c | 8 +++---- gcc/genoutput.c | 4 ++-- gcc/recog.h | 52 +++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 81 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44c9c9f6790..f1895106a76 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2013-08-29 Oleg Endo + + Backport from mainline + 2013-08-05 Oleg Endo + + PR other/12081 + * recog.h (rtx (*insn_gen_fn) (rtx, ...)): Replace typedef with new + class insn_gen_fn. + * expr.c (move_by_pieces_1, store_by_pieces_2): Replace argument + rtx (*) (rtx, ...) with insn_gen_fn. + * genoutput.c (output_insn_data): Cast gen_? function pointers to + insn_gen_fn::stored_funcptr. Add initializer braces. + + Backport from mainline + 2013-08-07 Oleg Endo + + PR other/12081 + * config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef. + (rs6000_emit_swdiv_high_precision, rs6000_emit_swdiv_low_precision, + rs6000_emit_swrsqrt): Don't cast result of GEN_FCN to gen_2arg_fn_t. + 2013-08-29 Jakub Jelinek Backported from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e8266decb90..e22c33dc37e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -284,9 +284,6 @@ static struct { "rsqrtd", (RECIP_DF_RSQRT | RECIP_V2DF_RSQRT) }, }; -/* 2 argument gen function typedef. */ -typedef rtx (*gen_2arg_fn_t) (rtx, rtx, rtx); - /* Pointer to function (in rs6000-c.c) that can define or undefine target macros that have changed. Languages that don't support the preprocessor don't link in rs6000-c.c, so we can't call it directly. */ @@ -26657,7 +26654,7 @@ rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d) enum machine_mode mode = GET_MODE (dst); rtx x0, e0, e1, y1, u0, v0; enum insn_code code = optab_handler (smul_optab, mode); - gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code); + insn_gen_fn gen_mul = GEN_FCN (code); rtx one = rs6000_load_constant_and_splat (mode, dconst1); gcc_assert (code != CODE_FOR_nothing); @@ -26695,7 +26692,7 @@ rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d) enum machine_mode mode = GET_MODE (dst); rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one; enum insn_code code = optab_handler (smul_optab, mode); - gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code); + insn_gen_fn gen_mul = GEN_FCN (code); gcc_assert (code != CODE_FOR_nothing); @@ -26766,7 +26763,7 @@ rs6000_emit_swrsqrt (rtx dst, rtx src) int i; rtx halfthree; enum insn_code code = optab_handler (smul_optab, mode); - gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code); + insn_gen_fn gen_mul = GEN_FCN (code); gcc_assert (code != CODE_FOR_nothing); diff --git a/gcc/expr.c b/gcc/expr.c index 2c5f21aa9a7..7e909bc0f5c 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -119,7 +119,7 @@ struct store_by_pieces_d int reverse; }; -static void move_by_pieces_1 (rtx (*) (rtx, ...), enum machine_mode, +static void move_by_pieces_1 (insn_gen_fn, machine_mode, struct move_by_pieces_d *); static bool block_move_libcall_safe_for_call_parm (void); static bool emit_block_move_via_movmem (rtx, rtx, rtx, unsigned, unsigned, HOST_WIDE_INT); @@ -128,7 +128,7 @@ static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned); static rtx clear_by_pieces_1 (void *, HOST_WIDE_INT, enum machine_mode); static void clear_by_pieces (rtx, unsigned HOST_WIDE_INT, unsigned int); static void store_by_pieces_1 (struct store_by_pieces_d *, unsigned int); -static void store_by_pieces_2 (rtx (*) (rtx, ...), enum machine_mode, +static void store_by_pieces_2 (insn_gen_fn, machine_mode, struct store_by_pieces_d *); static tree clear_storage_libcall_fn (int); static rtx compress_float_constant (rtx, rtx); @@ -1043,7 +1043,7 @@ move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align, to make a move insn for that mode. DATA has all the other info. */ static void -move_by_pieces_1 (rtx (*genfun) (rtx, ...), enum machine_mode mode, +move_by_pieces_1 (insn_gen_fn genfun, machine_mode mode, struct move_by_pieces_d *data) { unsigned int size = GET_MODE_SIZE (mode); @@ -2657,7 +2657,7 @@ store_by_pieces_1 (struct store_by_pieces_d *data ATTRIBUTE_UNUSED, to make a move insn for that mode. DATA has all the other info. */ static void -store_by_pieces_2 (rtx (*genfun) (rtx, ...), enum machine_mode mode, +store_by_pieces_2 (insn_gen_fn genfun, machine_mode mode, struct store_by_pieces_d *data) { unsigned int size = GET_MODE_SIZE (mode); diff --git a/gcc/genoutput.c b/gcc/genoutput.c index 995c5c55f11..59afaa452aa 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -404,9 +404,9 @@ output_insn_data (void) } if (d->name && d->name[0] != '*') - printf (" (insn_gen_fn) gen_%s,\n", d->name); + printf (" { (insn_gen_fn::stored_funcptr) gen_%s },\n", d->name); else - printf (" 0,\n"); + printf (" { 0 },\n"); printf (" &operand_data[%d],\n", d->operand_number); printf (" %d,\n", d->n_generator_args); diff --git a/gcc/recog.h b/gcc/recog.h index 67ad0f70d33..27e3b7c71db 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -256,7 +256,57 @@ extern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALT typedef int (*insn_operand_predicate_fn) (rtx, enum machine_mode); typedef const char * (*insn_output_fn) (rtx *, rtx); -typedef rtx (*insn_gen_fn) (rtx, ...); + +struct insn_gen_fn +{ + typedef rtx (*f0) (void); + typedef rtx (*f1) (rtx); + typedef rtx (*f2) (rtx, rtx); + typedef rtx (*f3) (rtx, rtx, rtx); + typedef rtx (*f4) (rtx, rtx, rtx, rtx); + typedef rtx (*f5) (rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f6) (rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f10) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f11) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f12) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f13) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f14) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f15) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx (*f16) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + + typedef f0 stored_funcptr; + + rtx operator () (void) const { return ((f0)func) (); } + rtx operator () (rtx a0) const { return ((f1)func) (a0); } + rtx operator () (rtx a0, rtx a1) const { return ((f2)func) (a0, a1); } + rtx operator () (rtx a0, rtx a1, rtx a2) const { return ((f3)func) (a0, a1, a2); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3) const { return ((f4)func) (a0, a1, a2, a3); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4) const { return ((f5)func) (a0, a1, a2, a3, a4); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5) const { return ((f6)func) (a0, a1, a2, a3, a4, a5); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6) const { return ((f7)func) (a0, a1, a2, a3, a4, a5, a6); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7) const { return ((f8)func) (a0, a1, a2, a3, a4, a5, a6, a7); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8) const { return ((f9)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9) const { return ((f10)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10) const { return ((f11)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11) const { return ((f12)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12) const { return ((f13)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13) const { return ((f14)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14) const { return ((f15)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14, rtx a15) const { return ((f16)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + + // This is for compatibility of code that invokes functions like + // (*funcptr) (arg) + insn_gen_fn operator * (void) const { return *this; } + + // The wrapped function pointer must be public and there must not be any + // constructors. Otherwise the insn_data_d struct initializers generated + // by genoutput.c will result in static initializer functions, which defeats + // the purpose of the generated insn_data_d array. + stored_funcptr func; +}; struct insn_operand_data { -- cgit v1.2.3 From b94d9203a6431d7bb1c331872207c022270be036 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 30 Aug 2013 00:16:37 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202091 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c1110c20e13..90c5253341a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130829 +20130830 -- cgit v1.2.3 From c37dd37338fe536ba37b26ee6120f79519590be2 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 30 Aug 2013 12:53:47 +0000 Subject: PR tree-optimization/58277 * tree-ssa-strlen.c (strlen_enter_block): If do_invalidate gave up after seeing too many stmts with vdef in between dombb and current bb, invalidate everything. * gcc.c-torture/execute/pr58277-1.c: New test. * gcc.c-torture/execute/pr58277-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202105 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 ++ gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/gcc.c-torture/execute/pr58277-1.c | 102 ++++++++++++++++++++++++ gcc/testsuite/gcc.c-torture/execute/pr58277-2.c | 98 +++++++++++++++++++++++ gcc/tree-ssa-strlen.c | 22 +++++ 5 files changed, 235 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58277-1.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58277-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f1895106a76..6e0d8ce5f6d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-08-30 Jakub Jelinek + + PR tree-optimization/58277 + * tree-ssa-strlen.c (strlen_enter_block): If do_invalidate gave up + after seeing too many stmts with vdef in between dombb and current + bb, invalidate everything. + 2013-08-29 Oleg Endo Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d4e9f2d7939..82f8ecdbc84 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-08-30 Jakub Jelinek + + PR tree-optimization/58277 + * gcc.c-torture/execute/pr58277-1.c: New test. + * gcc.c-torture/execute/pr58277-2.c: New test. + 2013-08-29 Jakub Jelinek Backported from mainline diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58277-1.c b/gcc/testsuite/gcc.c-torture/execute/pr58277-1.c new file mode 100644 index 00000000000..811988f4371 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58277-1.c @@ -0,0 +1,102 @@ +/* PR tree-optimization/58277 */ + +extern void abort (void); +static int a[2]; +int b, c, d, *e, f, g, h, **i = &e, k, l = 1, n, o, p; +static int **volatile j = &e; +const int m; +char u; + +int +bar () +{ + u = 0; + return m; +} + +__attribute__((noinline, noclone)) void +baz () +{ + asm (""); +} + +static int +foo () +{ + int t1; + g = bar (); + if (l) + ; + else + for (;; h++) + { + *i = 0; + o = *e = 0; + if (p) + { + f = 0; + return 0; + } + for (;; k++) + { + int *t2 = 0; + int *const *t3[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, &t2, 0, 0, &t2, &t2, &t2, + &t2, &t2, 0, 0, 0, 0, 0, 0, 0, &t2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, &t2, 0, 0, 0, 0, 0, 0, 0, &t2, &t2, + &t2, &t2, &t2, 0, 0, 0, 0, 0, 0, 0, &t2, 0, 0, 0, + &t2, 0, 0, 0, &t2, 0, &t2, 0, 0, &t2, 0, 0, 0, 0, + 0, &t2, 0, 0, 0, 0, &t2, &t2, 0, 0, 0, 0, &t2, 0, + 0, 0, 0, 0, 0, 0, &t2, 0, 0, 0, 0, 0, &t2, 0, 0, 0, + &t2, &t2 + }; + int *const **t4[] = {&t3[0]}; + **i = 0; + if (**j) + break; + u = 0; + } + *i = *j; + t1 = 0; + for (; t1 < 5; t1++) + *i = *j; + } + *j = 0; + return 1; +} + +int +main () +{ + int t5; + a[0] = 1; + { + int *t6[6] = {&d, &d}; + for (n = 1; n; n--) + if (foo()) + { + int *t7[] = {0}; + d = 0; + for (; u < 1; u++) + *i = *j; + *i = 0; + *i = 0; + int t8[5] = {0}; + *i = &t8[0]; + int *const *t9 = &t6[0]; + int *const **t10 = &t9; + *t10 = &t7[0]; + } + } + u = 0; + for (; b; b++) + for (t5 = 0; t5 < 10; t5++) + c = a[a[a[a[a[a[a[a[c]]]]]]]]; + + baz (); + + if (!a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[u]]]]]]]]]]]]]]]) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58277-2.c b/gcc/testsuite/gcc.c-torture/execute/pr58277-2.c new file mode 100644 index 00000000000..d919c2f3f80 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58277-2.c @@ -0,0 +1,98 @@ +/* PR tree-optimization/58277 */ + +extern void abort (void); +static int a[1], b, c, e, i, j, k, m, q[] = { 1, 1 }, t; +int volatile d; +int **r; +static int ***volatile s = &r; +int f, g, o, x; +static int *volatile h = &f, *p; +char n; + +static void +fn1 () +{ + b = a[a[a[a[a[a[a[a[b]]]]]]]]; + b = a[a[a[a[a[a[a[a[b]]]]]]]]; + b = a[a[b]]; + b = a[a[a[a[a[a[a[a[b]]]]]]]]; + b = a[a[a[a[a[a[a[a[b]]]]]]]]; +} + +static int +fn2 () +{ + n = 0; + for (; g; t++) + { + for (;; m++) + { + d; + int *u; + int **v[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, &u, 0, 0, 0, 0, &u, &u, &u, &u, &u, &u, &u, 0, + &u, 0, &u, &u, &u, 0, &u, &u, 0, &u, &u, &u, &u, 0, &u, &u, &u, + &u, &u, 0, &u, &u, 0, &u, 0, &u, &u, 0, &u, &u, &u, &u, &u, 0, + &u, 0, 0, 0, &u, &u, &u, 0, 0, &u, &u, &u, 0, &u, 0, &u, &u + }; + int ***w[] = { &v[0] }; + if (*p) + break; + return 0; + } + *h = 0; + } + return 1; +} + +static void +fn3 () +{ + int *y[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + for (; i; i++) + x = 0; + if (fn2 ()) + { + int *z[6] = { }; + for (; n < 1; n++) + *h = 0; + int t1[7]; + for (; c; c++) + o = t1[0]; + for (; e; e--) + { + int **t2 = &y[0]; + int ***t3 = &t2; + *t3 = &z[0]; + } + } + *s = 0; + for (n = 0;; n = 0) + { + int t4 = 0; + if (q[n]) + break; + *r = &t4; + } +} + +int +main () +{ + for (; j; j--) + a[0] = 0; + fn3 (); + for (; k; k++) + fn1 (); + fn1 (); + + if (n) + abort (); + + return 0; +} diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index fcb4ab890f6..dbad4a80d86 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -1890,6 +1890,28 @@ strlen_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, int count_vdef = 100; do_invalidate (dombb, phi, visited, &count_vdef); BITMAP_FREE (visited); + if (count_vdef == 0) + { + /* If there were too many vdefs in between immediate + dominator and current bb, invalidate everything. + If stridx_to_strinfo has been unshared, we need + to free it, otherwise just set it to NULL. */ + if (!strinfo_shared ()) + { + unsigned int i; + strinfo si; + + for (i = 1; + vec_safe_iterate (stridx_to_strinfo, i, &si); + ++i) + { + free_strinfo (si); + (*stridx_to_strinfo)[i] = NULL; + } + } + else + stridx_to_strinfo = NULL; + } break; } } -- cgit v1.2.3 From 5f0d6bc08b1da7efb90192643b65c4ce06f14b33 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 31 Aug 2013 00:16:24 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202123 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 90c5253341a..aa026ab4cc3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130830 +20130831 -- cgit v1.2.3 From 5890dbddeac595da34db8faff39e4d05120511c0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 1 Sep 2013 00:16:28 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202138 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index aa026ab4cc3..4134370d972 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130831 +20130901 -- cgit v1.2.3 From 76c457d75a19479b3e241e53c535b761eead7bc7 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sun, 1 Sep 2013 16:53:04 +0000 Subject: * config/pa/pa.md: Allow "const 0" operand 1 in "scc" insns. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202151 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/pa/pa.md | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e0d8ce5f6d..ef0bbcd1c81 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-09-01 John David Anglin + + * config/pa/pa.md: Allow "const 0" operand 1 in "scc" insns. + 2013-08-30 Jakub Jelinek PR tree-optimization/58277 diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 5e6d5652e71..bcafc5c5329 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -833,7 +833,7 @@ (define_insn "scc" [(set (match_operand:SI 0 "register_operand" "=r") (match_operator:SI 3 "comparison_operator" - [(match_operand:SI 1 "register_operand" "r") + [(match_operand:SI 1 "reg_or_0_operand" "rM") (match_operand:SI 2 "arith11_operand" "rI")]))] "" "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0" @@ -843,7 +843,7 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (match_operator:DI 3 "comparison_operator" - [(match_operand:DI 1 "register_operand" "r") + [(match_operand:DI 1 "reg_or_0_operand" "rM") (match_operand:DI 2 "arith11_operand" "rI")]))] "TARGET_64BIT" "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0" @@ -853,10 +853,10 @@ (define_insn "iorscc" [(set (match_operand:SI 0 "register_operand" "=r") (ior:SI (match_operator:SI 3 "comparison_operator" - [(match_operand:SI 1 "register_operand" "r") + [(match_operand:SI 1 "reg_or_0_operand" "rM") (match_operand:SI 2 "arith11_operand" "rI")]) (match_operator:SI 6 "comparison_operator" - [(match_operand:SI 4 "register_operand" "r") + [(match_operand:SI 4 "reg_or_0_operand" "rM") (match_operand:SI 5 "arith11_operand" "rI")])))] "" "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0" @@ -866,10 +866,10 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (ior:DI (match_operator:DI 3 "comparison_operator" - [(match_operand:DI 1 "register_operand" "r") + [(match_operand:DI 1 "reg_or_0_operand" "rM") (match_operand:DI 2 "arith11_operand" "rI")]) (match_operator:DI 6 "comparison_operator" - [(match_operand:DI 4 "register_operand" "r") + [(match_operand:DI 4 "reg_or_0_operand" "rM") (match_operand:DI 5 "arith11_operand" "rI")])))] "TARGET_64BIT" "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0" @@ -881,7 +881,7 @@ (define_insn "negscc" [(set (match_operand:SI 0 "register_operand" "=r") (neg:SI (match_operator:SI 3 "comparison_operator" - [(match_operand:SI 1 "register_operand" "r") + [(match_operand:SI 1 "reg_or_0_operand" "rM") (match_operand:SI 2 "arith11_operand" "rI")])))] "" "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0" @@ -891,7 +891,7 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r") (neg:DI (match_operator:DI 3 "comparison_operator" - [(match_operand:DI 1 "register_operand" "r") + [(match_operand:DI 1 "reg_or_0_operand" "rM") (match_operand:DI 2 "arith11_operand" "rI")])))] "TARGET_64BIT" "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0" -- cgit v1.2.3 From 45993f2d0a21c49556fab1b2b720d6468f189c4f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 2 Sep 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202157 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4134370d972..15420bcb17c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130901 +20130902 -- cgit v1.2.3 From 8b82c1e89d5b7dedbbdbf7deba20f281f7a86834 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Mon, 2 Sep 2013 15:11:47 +0000 Subject: Backport from mainline 2013-08-31 Uros Bizjak * config/alpha/alpha.c (alpha_emit_conditional_move): Update "cmp" RTX before signed_comparison_operator check to account for "code" changes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202177 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/alpha/alpha.c | 1 + 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef0bbcd1c81..7cd096505ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-01 Uros Bizjak + + Backport from mainline + 2013-08-31 Uros Bizjak + + * config/alpha/alpha.c (alpha_emit_conditional_move): Update + "cmp" RTX before signed_comparison_operator check to account + for "code" changes. + 2013-09-01 John David Anglin * config/pa/pa.md: Allow "const 0" operand 1 in "scc" insns. diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 8f95317e083..5bd49f96daa 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -2659,6 +2659,7 @@ alpha_emit_conditional_move (rtx cmp, enum machine_mode mode) cmp_mode = cmp_mode == DImode ? DFmode : DImode; op0 = gen_lowpart (cmp_mode, tem); op1 = CONST0_RTX (cmp_mode); + cmp = gen_rtx_fmt_ee (code, VOIDmode, op0, op1); local_fast_math = 1; } -- cgit v1.2.3 From c8d00681abd2594caa0133da6829133acf17babc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 3 Sep 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202194 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 15420bcb17c..b24b9916fe4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130902 +20130903 -- cgit v1.2.3 From 5c27e837e06e0c07e2e9fe1f50c8466bb75876b5 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 3 Sep 2013 10:12:44 +0000 Subject: 2013-09-03 Paolo Carlini PR libstdc++/58302 * include/bits/random.tcc (negative_binomial_distribution<>:: operator()(_UniformRandomNumberGenerator&, const param_type&): Fix typo in template argument. * testsuite/26_numerics/random/negative_binomial_distribution/ operators/58302.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202209 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 ++++++ libstdc++-v3/include/bits/random.tcc | 2 +- .../operators/58302.cc | 34 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/58302.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 59a868684d5..b0a39696f83 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2013-09-03 Paolo Carlini + + PR libstdc++/58302 + * include/bits/random.tcc (negative_binomial_distribution<>:: + operator()(_UniformRandomNumberGenerator&, const param_type&): + Fix typo in template argument. + * testsuite/26_numerics/random/negative_binomial_distribution/ + operators/58302.cc: New. + 2013-08-16 Uros Bizjak * src/c++98/compatibility.cc (_ZTIe): Use diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index c6db5b40cb7..10c65506f81 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -1291,7 +1291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator()(_UniformRandomNumberGenerator& __urng, const param_type& __p) { - typedef typename std::gamma_distribution::param_type + typedef typename std::gamma_distribution::param_type param_type; const double __y = diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/58302.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/58302.cc new file mode 100644 index 00000000000..3ced018ed3c --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/58302.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } +// { dg-require-cstdint "" } +// +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +void test01() +{ + typedef std::negative_binomial_distribution<> dist_type; + + std::default_random_engine engine; + + dist_type dist; + dist_type::param_type param(3, 0.5); + + dist(engine, param); // compile error! +} -- cgit v1.2.3 From 336eabb0224bd0db79209c2ab591f5b5ed2cc69c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 3 Sep 2013 12:13:42 +0000 Subject: 2013-09-03 Richard Biener * configure.ac: Also allow ISL 0.12. * configure: Regenerated. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202214 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog | 5 +++++ configure | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 3 +++ 3 files changed, 57 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1d0f9d736ba..0bc4cbb1c6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-09-03 Richard Biener + + * configure.ac: Also allow ISL 0.12. + * configure: Regenerated. + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/configure b/configure index d809535ed0a..e1d1c71fca4 100755 --- a/configure +++ b/configure @@ -5939,6 +5939,55 @@ $as_echo "$gcc_cv_isl" >&6; } fi + if test "${gcc_cv_isl}" = no ; then + + if test "${ENABLE_ISL_CHECK}" = yes ; then + _isl_saved_CFLAGS=$CFLAGS + _isl_saved_LDFLAGS=$LDFLAGS + _isl_saved_LIBS=$LIBS + + CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}" + LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs}" + LIBS="${_isl_saved_LIBS} -lisl" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.12 of ISL" >&5 +$as_echo_n "checking for version 0.12 of ISL... " >&6; } + if test "$cross_compiling" = yes; then : + gcc_cv_isl=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ +if (strncmp (isl_version (), "isl-0.12", strlen ("isl-0.12")) != 0) + return 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gcc_cv_isl=yes +else + gcc_cv_isl=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_isl" >&5 +$as_echo "$gcc_cv_isl" >&6; } + + CFLAGS=$_isl_saved_CFLAGS + LDFLAGS=$_isl_saved_LDFLAGS + LIBS=$_isl_saved_LIBS + fi + + + fi fi diff --git a/configure.ac b/configure.ac index 48ec1aae6b4..637da1ea51d 100644 --- a/configure.ac +++ b/configure.ac @@ -1630,6 +1630,9 @@ if test "x$with_isl" != "xno" && ISL_CHECK_VERSION(0,10) if test "${gcc_cv_isl}" = no ; then ISL_CHECK_VERSION(0,11) + if test "${gcc_cv_isl}" = no ; then + ISL_CHECK_VERSION(0,12) + fi fi dnl Only execute fail-action, if ISL has been requested. ISL_IF_FAILED([ -- cgit v1.2.3 From eb0609a5cf60a4e2ecfc22e07917ddb7e8ca9ea3 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 3 Sep 2013 12:14:58 +0000 Subject: 2013-09-03 Richard Biener Backport from mainline 2013-08-30 Richard Biener PR tree-optimization/58010 * tree-vect-loop.c (vect_create_epilog_for_reduction): Remove assert that we have a loop-closed PHI. * gcc.dg/pr58010.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202215 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pr58010.c | 15 +++++++++++++++ gcc/tree-vect-loop.c | 5 ++--- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr58010.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7cd096505ee..fddad420fbd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58010 + * tree-vect-loop.c (vect_create_epilog_for_reduction): Remove + assert that we have a loop-closed PHI. + 2013-09-01 Uros Bizjak Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 82f8ecdbc84..9a8780eed1d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58010 + * gcc.dg/pr58010.c: New testcase. + 2013-08-30 Jakub Jelinek PR tree-optimization/58277 diff --git a/gcc/testsuite/gcc.dg/pr58010.c b/gcc/testsuite/gcc.dg/pr58010.c new file mode 100644 index 00000000000..a0fbd31f495 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58010.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -funswitch-loops -ftree-vectorize" } */ + +short a, b, c, d; + +void f(void) +{ + short e; + + for(; e; e++) + for(; b; b++); + + for(d = 0; d < 4; d++) + a ^= (e ^= 1) || c ? : e; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1252c5a04fc..925b84832ef 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4329,9 +4329,8 @@ vect_finalize_reduction: if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))) phis.safe_push (USE_STMT (use_p)); - /* We expect to have found an exit_phi because of loop-closed-ssa - form. */ - gcc_assert (!phis.is_empty ()); + /* While we expect to have found an exit_phi because of loop-closed-ssa + form we can end up without one if the scalar cycle is dead. */ FOR_EACH_VEC_ELT (phis, i, exit_phi) { -- cgit v1.2.3 From b311fdca4d5ef7f9e02ec0a2410c086f6f389e00 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 3 Sep 2013 12:16:28 +0000 Subject: 2013-09-03 Richard Biener Backport from mainline 2013-08-30 Richard Biener PR tree-optimization/58228 * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not allow invariant loads in nested loop vectorization. * gcc.dg/torture/pr58228.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202216 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr58228.c | 15 +++++++++++++++ gcc/tree-vect-data-refs.c | 9 ++++++++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58228.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fddad420fbd..2aec2daa73e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58228 + * tree-vect-data-refs.c (vect_analyze_data_ref_access): Do not + allow invariant loads in nested loop vectorization. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9a8780eed1d..1bfe89dc74c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58228 + * gcc.dg/torture/pr58228.c: New testcase. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr58228.c b/gcc/testsuite/gcc.dg/torture/pr58228.c new file mode 100644 index 00000000000..d12303a008d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58228.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +extern void abort (void); +int a[8][8] = {{1}}; +int b, c, d, e; + +int main () +{ + for (c = 0; c < 8; c++) + for (b = 0; b < 2; b++) + a[b + 4][c] = a[c][0]; + if (a[4][4] != 1) + abort (); + return 0; +} diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index fdb73c3212b..1d5d0227545 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2498,10 +2498,17 @@ vect_analyze_data_ref_access (struct data_reference *dr) return false; } - /* Allow invariant loads in loops. */ + /* Allow invariant loads in not nested loops. */ if (loop_vinfo && integer_zerop (step)) { GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL; + if (nested_in_vect_loop_p (loop, stmt)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "zero step in inner loop of nest"); + return false; + } return DR_IS_READ (dr); } -- cgit v1.2.3 From 26a73ace74c7ba5b719ec056a783bb9655262ddc Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 3 Sep 2013 12:18:34 +0000 Subject: 2013-09-03 Richard Biener Backport from mainline 2013-08-29 Richard Biener PR tree-optimization/58246 * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Properly handle the dominance check inside a basic-block. * gcc.dg/torture/pr58246.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202217 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr58246.c | 21 +++++++++++++++++++++ gcc/tree-ssa-dce.c | 5 +++++ 4 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58246.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2aec2daa73e..7bb657b0c16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-29 Richard Biener + + PR tree-optimization/58246 + * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Properly + handle the dominance check inside a basic-block. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bfe89dc74c..5310a66c3d0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-03 Richard Biener + + Backport from mainline + 2013-08-29 Richard Biener + + PR tree-optimization/58246 + * gcc.dg/torture/pr58246.c: New testcase. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr58246.c b/gcc/testsuite/gcc.dg/torture/pr58246.c new file mode 100644 index 00000000000..5417abf913d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58246.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ + +extern void abort (void); + +int a, b; + +int main () +{ + int t[2] = {1,1}; + + for (a = 0; a < 2; a++) + { + b ^= t[a]; + t[a] = t[1] = 0; + } + + if (b != 1) + abort (); + + return 0; +} diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 05c58feca5d..24e2db29aae 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -574,6 +574,11 @@ mark_aliased_reaching_defs_necessary_1 (ao_ref *ref, tree vdef, void *data) in the references (gcc.c-torture/execute/pr42142.c). The simplest way is to check if the kill dominates the use. */ + /* But when both are in the same block we cannot + easily tell whether we came from a backedge + unless we decide to compute stmt UIDs + (see PR58246). */ + && (basic_block) data != gimple_bb (def_stmt) && dominated_by_p (CDI_DOMINATORS, (basic_block) data, gimple_bb (def_stmt)) && operand_equal_p (ref->ref, lhs, 0)) -- cgit v1.2.3 From 1bf41d6505a714b005557310890408308dde09e5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 3 Sep 2013 21:58:47 +0000 Subject: compiler, runtime: Use runtime functions to pass closure value. This changes the compiler and runtime to not pass a closure value as the last argument, but to instead pass it via __go_set_closure and retrieve it via __go_get_closure. This eliminates the need for function descriptor wrapper functions. It will make it possible to retrieve the closure value in a reflect.MakeFunc function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202234 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 121 ++++++++++++++++-------------- gcc/go/gofrontend/expressions.h | 13 +--- gcc/go/gofrontend/gogo-tree.cc | 87 ++++++---------------- gcc/go/gofrontend/gogo.cc | 155 +++++++++++---------------------------- gcc/go/gofrontend/gogo.h | 13 ---- gcc/go/gofrontend/statements.cc | 49 ++++--------- gcc/go/gofrontend/statements.h | 46 ++++++++++++ gcc/go/gofrontend/types.cc | 25 ++----- gcc/go/gofrontend/types.h | 8 +- libgo/go/reflect/value.go | 7 -- libgo/runtime/go-reflect-call.c | 17 ++--- libgo/runtime/mgc0.c | 7 +- libgo/runtime/proc.c | 20 +++++ libgo/runtime/runtime.h | 4 + libgo/runtime/time.goc | 8 +- 15 files changed, 237 insertions(+), 343 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 2b60d90a5dc..78a427398c2 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1382,7 +1382,7 @@ Expression::make_func_reference(Named_object* function, Expression* closure, Func_descriptor_expression::Func_descriptor_expression(Named_object* fn) : Expression(EXPRESSION_FUNC_DESCRIPTOR, fn->location()), - fn_(fn), dfn_(NULL), dvar_(NULL) + fn_(fn), dvar_(NULL) { go_assert(!fn->is_function() || !fn->func_value()->needs_closure()); } @@ -1417,18 +1417,6 @@ Func_descriptor_expression::do_type() return Func_descriptor_expression::descriptor_type; } -// Copy a Func_descriptor_expression; - -Expression* -Func_descriptor_expression::do_copy() -{ - Func_descriptor_expression* fde = - Expression::make_func_descriptor(this->fn_); - if (this->dfn_ != NULL) - fde->set_descriptor_wrapper(this->dfn_); - return fde; -} - // The tree for a function descriptor. tree @@ -1455,11 +1443,8 @@ Func_descriptor_expression::do_get_tree(Translate_context* context) Bvariable* bvar; if (no->package() != NULL || Linemap::is_predeclared_location(no->location())) - { - bvar = context->backend()->immutable_struct_reference(var_name, btype, - loc); - go_assert(this->dfn_ == NULL); - } + bvar = context->backend()->immutable_struct_reference(var_name, btype, + loc); else { Location bloc = Linemap::predeclared_location(); @@ -1469,8 +1454,7 @@ Func_descriptor_expression::do_get_tree(Translate_context* context) bvar = context->backend()->immutable_struct(var_name, is_hidden, false, btype, bloc); Expression_list* vals = new Expression_list(); - go_assert(this->dfn_ != NULL); - vals->push_back(Expression::make_func_code_reference(this->dfn_, bloc)); + vals->push_back(Expression::make_func_code_reference(this->fn_, bloc)); Expression* init = Expression::make_struct_composite_literal(this->type(), vals, bloc); Translate_context bcontext(gogo, NULL, NULL, NULL); @@ -6792,8 +6776,8 @@ Bound_method_expression::create_thunk(Gogo* gogo, const Method* method, } Struct_field_list* sfl = new Struct_field_list(); - // The type here is wrong--it should be new_fntype. But we don't - // have new_fntype yet, and it doesn't really matter. + // The type here is wrong--it should be the C function type. But it + // doesn't really matter. Type* vt = Type::make_pointer_type(Type::make_void_type()); sfl->push_back(Struct_field(Typed_identifier("fn.0", vt, loc))); sfl->push_back(Struct_field(Typed_identifier("val.1", @@ -6802,17 +6786,17 @@ Bound_method_expression::create_thunk(Gogo* gogo, const Method* method, Type* closure_type = Type::make_struct_type(sfl, loc); closure_type = Type::make_pointer_type(closure_type); - Function_type* new_fntype = orig_fntype->copy_with_closure(closure_type); + Function_type* new_fntype = orig_fntype->copy_with_names(); Named_object* new_no = gogo->start_function(Gogo::thunk_name(), new_fntype, false, loc); - gogo->start_block(loc); + Variable* cvar = new Variable(closure_type, NULL, false, false, false, loc); + cvar->set_is_used(); + Named_object* cp = Named_object::make_variable("$closure", NULL, cvar); + new_no->func_value()->set_closure_var(cp); - Named_object* cp = gogo->lookup("closure.0", NULL); - go_assert(cp != NULL - && cp->is_variable() - && cp->var_value()->is_parameter()); + gogo->start_block(loc); // Field 0 of the closure is the function code pointer, field 1 is // the value on which to invoke the method. @@ -6831,7 +6815,7 @@ Bound_method_expression::create_thunk(Gogo* gogo, const Method* method, const Typed_identifier_list* new_params = new_fntype->parameters(); args = new Expression_list(); for (Typed_identifier_list::const_iterator p = new_params->begin(); - p + 1 != new_params->end(); + p != new_params->end(); ++p) { Named_object* p_no = gogo->lookup(p->name(), NULL); @@ -9729,21 +9713,21 @@ Call_expression::do_get_tree(Translate_context* context) const bool has_closure = func != NULL && func->closure() != NULL; const bool is_interface_method = interface_method != NULL; - int closure_arg; + bool has_closure_arg; if (has_closure) - closure_arg = 1; + has_closure_arg = true; else if (func != NULL) - closure_arg = 0; + has_closure_arg = false; else if (is_interface_method) - closure_arg = 0; + has_closure_arg = false; else - closure_arg = 1; + has_closure_arg = true; int nargs; tree* args; if (this->args_ == NULL || this->args_->empty()) { - nargs = (is_interface_method ? 1 : 0) + closure_arg; + nargs = is_interface_method ? 1 : 0; args = nargs == 0 ? NULL : new tree[nargs]; } else if (fntype->parameters() == NULL || fntype->parameters()->empty()) @@ -9752,7 +9736,7 @@ Call_expression::do_get_tree(Translate_context* context) go_assert(!is_interface_method && fntype->is_method() && this->args_->size() == 1); - nargs = 1 + closure_arg; + nargs = 1; args = new tree[nargs]; args[0] = this->args_->front()->get_tree(context); } @@ -9763,7 +9747,6 @@ Call_expression::do_get_tree(Translate_context* context) nargs = this->args_->size(); int i = is_interface_method ? 1 : 0; nargs += i; - nargs += closure_arg; args = new tree[nargs]; Typed_identifier_list::const_iterator pp = params->begin(); @@ -9787,7 +9770,7 @@ Call_expression::do_get_tree(Translate_context* context) return error_mark_node; } go_assert(pp == params->end()); - go_assert(i + closure_arg == nargs); + go_assert(i == nargs); } tree fntype_tree = type_to_tree(fntype->get_backend(gogo)); @@ -9806,21 +9789,23 @@ Call_expression::do_get_tree(Translate_context* context) return error_mark_node; tree fn; + tree closure_tree; if (func != NULL) { Named_object* no = func->named_object(); - go_assert(!no->is_function() - || !no->func_value()->is_descriptor_wrapper()); fn = Func_expression::get_code_pointer(gogo, no, location); - if (has_closure) + if (!has_closure) + closure_tree = NULL_TREE; + else { - go_assert(closure_arg == 1 && nargs > 0); - args[nargs - 1] = func->closure()->get_tree(context); + closure_tree = func->closure()->get_tree(context); + if (closure_tree == error_mark_node) + return error_mark_node; } } else if (!is_interface_method) { - tree closure_tree = this->fn_->get_tree(context); + closure_tree = this->fn_->get_tree(context); if (closure_tree == error_mark_node) return error_mark_node; tree fnc = fold_convert_loc(location.gcc_location(), fntype_tree, @@ -9834,8 +9819,6 @@ Call_expression::do_get_tree(Translate_context* context) build_fold_indirect_ref_loc(location.gcc_location(), fnc), field, NULL_TREE); - go_assert(closure_arg == 1 && nargs > 0); - args[nargs - 1] = closure_tree; } else { @@ -9843,7 +9826,7 @@ Call_expression::do_get_tree(Translate_context* context) &args[0]); if (fn == error_mark_node) return error_mark_node; - go_assert(closure_arg == 0); + closure_tree = NULL_TREE; } if (fn == error_mark_node || TREE_TYPE(fn) == error_mark_node) @@ -9894,6 +9877,32 @@ Call_expression::do_get_tree(Translate_context* context) if (func == NULL) fn = save_expr(fn); + if (!has_closure_arg) + go_assert(closure_tree == NULL_TREE); + else + { + // Pass the closure argument by calling the function function + // __go_set_closure. In the order_evaluations pass we have + // ensured that if any parameters contain call expressions, they + // will have been moved out to temporary variables. + + go_assert(closure_tree != NULL_TREE); + closure_tree = fold_convert_loc(location.gcc_location(), ptr_type_node, + closure_tree); + static tree set_closure_fndecl; + tree set_closure = Gogo::call_builtin(&set_closure_fndecl, + location, + "__go_set_closure", + 1, + void_type_node, + ptr_type_node, + closure_tree); + if (set_closure == error_mark_node) + return error_mark_node; + fn = build2_loc(location.gcc_location(), COMPOUND_EXPR, + TREE_TYPE(fn), set_closure, fn); + } + tree ret = build_call_array(excess_type != NULL_TREE ? excess_type : rettype, fn, nargs, args); delete[] args; @@ -11609,25 +11618,25 @@ Interface_field_reference_expression::create_thunk(Gogo* gogo, return Named_object::make_erroneous_name(Gogo::thunk_name()); Struct_field_list* sfl = new Struct_field_list(); - // The type here is wrong--it should be new_fntype. But we don't - // have new_fntype yet, and it doesn't really matter. + // The type here is wrong--it should be the C function type. But it + // doesn't really matter. Type* vt = Type::make_pointer_type(Type::make_void_type()); sfl->push_back(Struct_field(Typed_identifier("fn.0", vt, loc))); sfl->push_back(Struct_field(Typed_identifier("val.1", type, loc))); Type* closure_type = Type::make_struct_type(sfl, loc); closure_type = Type::make_pointer_type(closure_type); - Function_type* new_fntype = orig_fntype->copy_with_closure(closure_type); + Function_type* new_fntype = orig_fntype->copy_with_names(); Named_object* new_no = gogo->start_function(Gogo::thunk_name(), new_fntype, false, loc); - gogo->start_block(loc); + Variable* cvar = new Variable(closure_type, NULL, false, false, false, loc); + cvar->set_is_used(); + Named_object* cp = Named_object::make_variable("$closure", NULL, cvar); + new_no->func_value()->set_closure_var(cp); - Named_object* cp = gogo->lookup("closure.0", NULL); - go_assert(cp != NULL - && cp->is_variable() - && cp->var_value()->is_parameter()); + gogo->start_block(loc); // Field 0 of the closure is the function code pointer, field 1 is // the value on which to invoke the method. @@ -11647,7 +11656,7 @@ Interface_field_reference_expression::create_thunk(Gogo* gogo, const Typed_identifier_list* new_params = new_fntype->parameters(); args = new Expression_list(); for (Typed_identifier_list::const_iterator p = new_params->begin(); - p + 1 != new_params->end(); + p != new_params->end(); ++p) { Named_object* p_no = gogo->lookup(p->name(), NULL); diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 67a4bb985e6..95584f2748b 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -1570,14 +1570,6 @@ class Func_descriptor_expression : public Expression public: Func_descriptor_expression(Named_object* fn); - // Set the descriptor wrapper. - void - set_descriptor_wrapper(Named_object* dfn) - { - go_assert(this->dfn_ == NULL); - this->dfn_ = dfn; - } - // Make the function descriptor type, so that it can be converted. static void make_func_descriptor_type(); @@ -1594,7 +1586,8 @@ class Func_descriptor_expression : public Expression { } Expression* - do_copy(); + do_copy() + { return Expression::make_func_descriptor(this->fn_); } bool do_is_addressable() const @@ -1612,8 +1605,6 @@ class Func_descriptor_expression : public Expression // The function for which this is the descriptor. Named_object* fn_; - // The descriptor function. - Named_object* dfn_; // The descriptor variable. Bvariable* dvar_; }; diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index a1fe5fec7ca..69797f93342 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -1289,30 +1289,6 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); go_assert(FUNCTION_POINTER_TYPE_P(functype)); functype = TREE_TYPE(functype); - - // In the struct, the function type always has a trailing - // closure argument. For the function body, we only use - // that trailing arg if this is a function literal or if it - // is a wrapper created to store in a descriptor. Remove it - // in that case. - if (this->enclosing_ == NULL && !this->is_descriptor_wrapper_) - { - tree old_params = TYPE_ARG_TYPES(functype); - go_assert(old_params != NULL_TREE - && old_params != void_list_node); - tree new_params = NULL_TREE; - tree *pp = &new_params; - while (TREE_CHAIN (old_params) != void_list_node) - { - tree p = TREE_VALUE(old_params); - go_assert(TYPE_P(p)); - *pp = tree_cons(NULL_TREE, p, NULL_TREE); - pp = &TREE_CHAIN(*pp); - old_params = TREE_CHAIN (old_params); - } - *pp = void_list_node; - functype = build_function_type(TREE_TYPE(functype), new_params); - } } if (functype == error_mark_node) @@ -1423,26 +1399,6 @@ Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); go_assert(FUNCTION_POINTER_TYPE_P(functype)); functype = TREE_TYPE(functype); - - // In the struct, the function type always has a trailing - // closure argument. Here we are referring to the function - // code directly, and we know it is not a function literal, - // and we know it is not a wrapper created to store in a - // descriptor. Remove that trailing argument. - tree old_params = TYPE_ARG_TYPES(functype); - go_assert(old_params != NULL_TREE && old_params != void_list_node); - tree new_params = NULL_TREE; - tree *pp = &new_params; - while (TREE_CHAIN (old_params) != void_list_node) - { - tree p = TREE_VALUE(old_params); - go_assert(TYPE_P(p)); - *pp = tree_cons(NULL_TREE, p, NULL_TREE); - pp = &TREE_CHAIN(*pp); - old_params = TREE_CHAIN (old_params); - } - *pp = void_list_node; - functype = build_function_type(TREE_TYPE(functype), new_params); } tree decl; @@ -1659,8 +1615,13 @@ Function::build_tree(Gogo* gogo, Named_object* named_function) } } - // The closure variable is passed last, if this is a function - // literal or a descriptor wrapper. + *pp = NULL_TREE; + + DECL_ARGUMENTS(fndecl) = params; + + // If we need a closure variable, fetch it by calling a runtime + // function. The caller will have called __go_set_closure before + // the function call. if (this->closure_var_ != NULL) { Bvariable* bvar = @@ -1668,25 +1629,25 @@ Function::build_tree(Gogo* gogo, Named_object* named_function) tree var_decl = var_to_tree(bvar); if (var_decl != error_mark_node) { - go_assert(TREE_CODE(var_decl) == PARM_DECL); - *pp = var_decl; - pp = &DECL_CHAIN(*pp); + go_assert(TREE_CODE(var_decl) == VAR_DECL); + static tree get_closure_fndecl; + tree get_closure = Gogo::call_builtin(&get_closure_fndecl, + this->location_, + "__go_get_closure", + 0, + ptr_type_node); + + // Mark the __go_get_closure function as pure, since it + // depends only on the global variable g. + DECL_PURE_P(get_closure_fndecl) = 1; + + get_closure = fold_convert_loc(this->location_.gcc_location(), + TREE_TYPE(var_decl), get_closure); + DECL_INITIAL(var_decl) = get_closure; + DECL_CHAIN(var_decl) = declare_vars; + declare_vars = var_decl; } } - else if (this->enclosing_ != NULL || this->is_descriptor_wrapper_) - { - tree parm_decl = build_decl(this->location_.gcc_location(), PARM_DECL, - get_identifier("$closure"), - const_ptr_type_node); - DECL_CONTEXT(parm_decl) = current_function_decl; - DECL_ARG_TYPE(parm_decl) = const_ptr_type_node; - *pp = parm_decl; - pp = &DECL_CHAIN(*pp); - } - - *pp = NULL_TREE; - - DECL_ARGUMENTS(fndecl) = params; if (this->block_ != NULL) { diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 4e5bd447831..be8ec5939f3 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1770,8 +1770,8 @@ Create_function_descriptors::function(Named_object* no) if (no->is_function() && no->func_value()->enclosing() == NULL && !no->func_value()->is_method() - && !no->func_value()->is_descriptor_wrapper() - && !Gogo::is_hidden_name(no->name())) + && !Gogo::is_hidden_name(no->name()) + && !Gogo::is_thunk(no)) no->func_value()->descriptor(this->gogo_, no); return TRAVERSE_CONTINUE; @@ -2541,13 +2541,38 @@ Order_eval::statement(Block* block, size_t* pindex, Statement* s) return TRAVERSE_CONTINUE; // If there is only one expression with a side-effect, we can - // usually leave it in place. However, for an assignment statement, - // we need to evaluate an expression on the right hand side before - // we evaluate any index expression on the left hand side, so for - // that case we always move the expression. Otherwise we mishandle - // m[0] = len(m) where m is a map. - if (c == 1 && s->classification() != Statement::STATEMENT_ASSIGNMENT) - return TRAVERSE_CONTINUE; + // usually leave it in place. + if (c == 1) + { + switch (s->classification()) + { + case Statement::STATEMENT_ASSIGNMENT: + // For an assignment statement, we need to evaluate an + // expression on the right hand side before we evaluate any + // index expression on the left hand side, so for that case + // we always move the expression. Otherwise we mishandle + // m[0] = len(m) where m is a map. + break; + + case Statement::STATEMENT_EXPRESSION: + { + // If this is a call statement that doesn't return any + // values, it will not have been counted as a value to + // move. We need to move any subexpressions in case they + // are themselves call statements that require passing a + // closure. + Expression* expr = s->expression_statement()->expr(); + if (expr->call_expression() != NULL + && expr->call_expression()->result_count() == 0) + break; + return TRAVERSE_CONTINUE; + } + + default: + // We can leave the expression in place. + return TRAVERSE_CONTINUE; + } + } bool is_thunk = s->thunk_statement() != NULL; for (Find_eval_ordering::const_iterator p = find_eval_ordering.begin(); @@ -2803,7 +2828,7 @@ Build_recover_thunks::function(Named_object* orig_no) Named_object* orig_closure_no = orig_func->closure_var(); Variable* orig_closure_var = orig_closure_no->var_value(); Variable* new_var = new Variable(orig_closure_var->type(), NULL, false, - true, false, location); + false, false, location); snprintf(buf, sizeof buf, "closure.%u", count); ++count; Named_object* new_closure_no = Named_object::make_variable(buf, NULL, @@ -3275,7 +3300,7 @@ Function::Function(Function_type* type, Function* enclosing, Block* block, local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL), is_sink_(false), results_are_named_(false), nointerface_(false), calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false), - in_unique_section_(false), is_descriptor_wrapper_(false) + in_unique_section_(false) { } @@ -3357,9 +3382,9 @@ Function::closure_var() Struct_field_list* sfl = new Struct_field_list; Type* struct_type = Type::make_struct_type(sfl, loc); Variable* var = new Variable(Type::make_pointer_type(struct_type), - NULL, false, true, false, loc); + NULL, false, false, false, loc); var->set_is_used(); - this->closure_var_ = Named_object::make_variable("closure", NULL, var); + this->closure_var_ = Named_object::make_variable("$closure", NULL, var); // Note that the new variable is not in any binding contour. } return this->closure_var_; @@ -3562,99 +3587,16 @@ Function::determine_types() this->block_->determine_types(); } -// Build a wrapper function for a function descriptor. A function -// descriptor refers to a function that takes a closure as its last -// argument. In this case there will be no closure, but an indirect -// call will pass nil as the last argument. We need to build a -// wrapper function that accepts and discards that last argument, so -// that cases like -mrtd will work correctly. In most cases the -// wrapper function will simply be a jump. - -Named_object* -Function::make_descriptor_wrapper(Gogo* gogo, Named_object* no, - Function_type* orig_fntype) -{ - Location loc = no->location(); - - Type* vt = Type::make_pointer_type(Type::make_void_type()); - Function_type* new_fntype = orig_fntype->copy_with_closure(vt); - - std::string name = no->name() + "$descriptorfn"; - Named_object* dno = gogo->start_function(name, new_fntype, false, loc); - dno->func_value()->is_descriptor_wrapper_ = true; - - // Put the wrapper in a unique section so that it can be discarded - // by the linker if it is not needed. Every top-level function will - // get a wrapper, in case there is a reference other than a call - // from some other package, but most will not need one. - dno->func_value()->set_in_unique_section(); - - gogo->start_block(loc); - - Expression* fn = Expression::make_func_reference(no, NULL, loc); - - // Call the function begin wrapped, passing all of the arguments - // except for the last one (the last argument is the ignored - // closure). - const Typed_identifier_list* orig_params = orig_fntype->parameters(); - Expression_list* args; - if (orig_params == NULL || orig_params->empty()) - args = NULL; - else - { - const Typed_identifier_list* new_params = new_fntype->parameters(); - args = new Expression_list(); - for (Typed_identifier_list::const_iterator p = new_params->begin(); - p + 1 != new_params->end(); - ++p) - { - Named_object* p_no = gogo->lookup(p->name(), NULL); - go_assert(p_no != NULL - && p_no->is_variable() - && p_no->var_value()->is_parameter()); - args->push_back(Expression::make_var_reference(p_no, loc)); - } - } - - Call_expression* call = Expression::make_call(fn, args, - orig_fntype->is_varargs(), - loc); - call->set_varargs_are_lowered(); - - Statement* s = Statement::make_return_from_call(call, loc); - gogo->add_statement(s); - Block* b = gogo->finish_block(loc); - gogo->add_block(b, loc); - gogo->lower_block(dno, b); - gogo->finish_function(loc); - - return dno; -} - // Return the function descriptor, the value you get when you refer to // the function in Go code without calling it. Expression* -Function::descriptor(Gogo* gogo, Named_object* no) +Function::descriptor(Gogo*, Named_object* no) { go_assert(!this->is_method()); go_assert(this->closure_var_ == NULL); - go_assert(!this->is_descriptor_wrapper_); if (this->descriptor_ == NULL) - { - // Make and record the descriptor first, so that when we lower - // the descriptor wrapper we don't try to make it again. - Func_descriptor_expression* descriptor = - Expression::make_func_descriptor(no); - this->descriptor_ = descriptor; - if (no->package() == NULL - && !Linemap::is_predeclared_location(no->location())) - { - Named_object* dno = Function::make_descriptor_wrapper(gogo, no, - this->type_); - descriptor->set_descriptor_wrapper(dno); - } - } + this->descriptor_ = Expression::make_func_descriptor(no); return this->descriptor_; } @@ -4193,24 +4135,11 @@ Bindings_snapshot::check_goto_defs(Location loc, const Block* block, // Return the function descriptor. Expression* -Function_declaration::descriptor(Gogo* gogo, Named_object* no) +Function_declaration::descriptor(Gogo*, Named_object* no) { go_assert(!this->fntype_->is_method()); if (this->descriptor_ == NULL) - { - // Make and record the descriptor first, so that when we lower - // the descriptor wrapper we don't try to make it again. - Func_descriptor_expression* descriptor = - Expression::make_func_descriptor(no); - this->descriptor_ = descriptor; - if (no->package() == NULL - && !Linemap::is_predeclared_location(no->location())) - { - Named_object* dno = Function::make_descriptor_wrapper(gogo, no, - this->fntype_); - descriptor->set_descriptor_wrapper(dno); - } - } + this->descriptor_ = Expression::make_func_descriptor(no); return this->descriptor_; } diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index b6e9e45a1cb..6a87f2d562c 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -1050,12 +1050,6 @@ class Function set_in_unique_section() { this->in_unique_section_ = true; } - // Whether this function was created as a descriptor wrapper for - // another function. - bool - is_descriptor_wrapper() const - { return this->is_descriptor_wrapper_; } - // Swap with another function. Used only for the thunk which calls // recover. void @@ -1085,10 +1079,6 @@ class Function this->descriptor_ = descriptor; } - // Build a descriptor wrapper function. - static Named_object* - make_descriptor_wrapper(Gogo*, Named_object*, Function_type*); - // Return the function's decl given an identifier. tree get_or_make_decl(Gogo*, Named_object*, tree id); @@ -1190,9 +1180,6 @@ class Function // True if this function should be put in a unique section. This is // turned on for field tracking. bool in_unique_section_ : 1; - // True if this is a function wrapper created to put in a function - // descriptor. - bool is_descriptor_wrapper_ : 1; }; // A snapshot of the current binding state. diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 7314918a9a1..0261f9d4882 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -1658,46 +1658,23 @@ Statement::make_tuple_type_guard_assignment(Expression* val, Expression* ok, location); } -// An expression statement. +// Class Expression_statement. -class Expression_statement : public Statement -{ - public: - Expression_statement(Expression* expr, bool is_ignored) - : Statement(STATEMENT_EXPRESSION, expr->location()), - expr_(expr), is_ignored_(is_ignored) - { } - - Expression* - expr() - { return this->expr_; } - - protected: - int - do_traverse(Traverse* traverse) - { return this->traverse_expression(traverse, &this->expr_); } - - void - do_determine_types() - { this->expr_->determine_type_no_context(); } - - void - do_check_types(Gogo*); - - bool - do_may_fall_through() const; +// Constructor. - Bstatement* - do_get_backend(Translate_context* context); +Expression_statement::Expression_statement(Expression* expr, bool is_ignored) + : Statement(STATEMENT_EXPRESSION, expr->location()), + expr_(expr), is_ignored_(is_ignored) +{ +} - void - do_dump_statement(Ast_dump_context*) const; +// Determine types. - private: - Expression* expr_; - // Whether the value of this expression is being explicitly ignored. - bool is_ignored_; -}; +void +Expression_statement::do_determine_types() +{ + this->expr_->determine_type_no_context(); +} // Check the types of an expression statement. The only check we do // is to possibly give an error about discarding the value of the diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h index fb2ae334293..b128fa0a8eb 100644 --- a/gcc/go/gofrontend/statements.h +++ b/gcc/go/gofrontend/statements.h @@ -17,6 +17,7 @@ class Function; class Unnamed_label; class Temporary_statement; class Variable_declaration_statement; +class Expression_statement; class Return_statement; class Thunk_statement; class Label_statement; @@ -329,6 +330,14 @@ class Statement STATEMENT_VARIABLE_DECLARATION>(); } + // If this is an expression statement, return it. Otherwise return + // NULL. + Expression_statement* + expression_statement() + { + return this->convert(); + } + // If this is a return statement, return it. Otherwise return NULL. Return_statement* return_statement() @@ -636,6 +645,43 @@ class Return_statement : public Statement bool is_lowered_; }; +// An expression statement. + +class Expression_statement : public Statement +{ + public: + Expression_statement(Expression* expr, bool is_ignored); + + Expression* + expr() + { return this->expr_; } + + protected: + int + do_traverse(Traverse* traverse) + { return this->traverse_expression(traverse, &this->expr_); } + + void + do_determine_types(); + + void + do_check_types(Gogo*); + + bool + do_may_fall_through() const; + + Bstatement* + do_get_backend(Translate_context* context); + + void + do_dump_statement(Ast_dump_context*) const; + + private: + Expression* expr_; + // Whether the value of this expression is being explicitly ignored. + bool is_ignored_; +}; + // A send statement. class Send_statement : public Statement diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index b32c0587e6c..9ce329d5503 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -3390,10 +3390,7 @@ Function_type::do_get_backend(Gogo* gogo) // When we do anything with a function value other than call it, it // is represented as a pointer to a struct whose first field is the // actual function. So that is what we return as the type of a Go - // function. The function stored in the first field always that - // takes one additional trailing argument: the closure pointer. For - // a top-level function, this additional argument will only be - // passed when invoking the function indirectly, via the struct. + // function. Location loc = this->location(); Btype* struct_type = @@ -3415,15 +3412,9 @@ Function_type::do_get_backend(Gogo* gogo) } std::vector bparameters; - size_t last; - if (this->parameters_ == NULL) - { - bparameters.resize(1); - last = 0; - } - else + if (this->parameters_ != NULL) { - bparameters.resize(this->parameters_->size() + 1); + bparameters.resize(this->parameters_->size()); size_t i = 0; for (Typed_identifier_list::const_iterator p = this->parameters_->begin(); p != this->parameters_->end(); @@ -3433,12 +3424,8 @@ Function_type::do_get_backend(Gogo* gogo) bparameters[i].btype = p->type()->get_backend(gogo); bparameters[i].location = p->location(); } - last = i; + go_assert(i == bparameters.size()); } - go_assert(last + 1 == bparameters.size()); - bparameters[last].name = "$closure"; - bparameters[last].btype = ptr_struct_type; - bparameters[last].location = loc; std::vector bresults; if (this->results_ != NULL) @@ -3840,7 +3827,7 @@ Function_type::copy_with_receiver(Type* receiver_type) const // closure parameter. Function_type* -Function_type::copy_with_closure(Type* closure_type) const +Function_type::copy_with_names() const { Typed_identifier_list* new_params = new Typed_identifier_list(); const Typed_identifier_list* orig_params = this->parameters_; @@ -3858,8 +3845,6 @@ Function_type::copy_with_closure(Type* closure_type) const p->location())); } } - new_params->push_back(Typed_identifier("closure.0", closure_type, - this->location_)); const Typed_identifier_list* orig_results = this->results_; Typed_identifier_list* new_results; diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index 8bc022eb824..d207fe5a375 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -1789,11 +1789,11 @@ class Function_type : public Type Function_type* copy_with_receiver(Type*) const; - // Return a copy of this type ignoring any receiver and adding a - // final closure parameter of type CLOSURE_TYPE. This is used when - // creating descriptors. + // Return a copy of this type ignoring any receiver and using dummy + // names for all parameters. This is used for thunks for method + // values. Function_type* - copy_with_closure(Type* closure_type) const; + copy_with_names() const; static Type* make_function_type_descriptor_type(); diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 6bf66c8caf6..45a08587973 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -434,9 +434,6 @@ func (v Value) call(op string, in []Value) []Value { nin++ } firstPointer := len(in) > 0 && Kind(t.In(0).(*rtype).kind) != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ) - if v.flag&flagMethod == 0 && !firstPointer { - nin++ - } params := make([]unsafe.Pointer, nin) off := 0 if v.flag&flagMethod != 0 { @@ -464,10 +461,6 @@ func (v Value) call(op string, in []Value) []Value { } off++ } - if v.flag&flagMethod == 0 && !firstPointer { - // Closure argument. - params[off] = unsafe.Pointer(&fn) - } ret := make([]Value, nout) results := make([]unsafe.Pointer, nout) diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c index 83b9eba0436..5cf370798bf 100644 --- a/libgo/runtime/go-reflect-call.c +++ b/libgo/runtime/go-reflect-call.c @@ -302,9 +302,7 @@ go_func_to_cif (const struct __go_func_type *func, _Bool is_interface, in_types = ((const struct __go_type_descriptor **) func->__in.__values); - num_args = (num_params - + (is_interface ? 1 : 0) - + (!is_interface && !is_method ? 1 : 0)); + num_args = num_params + (is_interface ? 1 : 0); args = (ffi_type **) __go_alloc (num_args * sizeof (ffi_type *)); i = 0; off = 0; @@ -321,12 +319,6 @@ go_func_to_cif (const struct __go_func_type *func, _Bool is_interface, for (; i < num_params; ++i) args[i + off] = go_type_to_ffi (in_types[i]); - if (!is_interface && !is_method) - { - // There is a closure argument, a pointer. - args[i + off] = &ffi_type_pointer; - } - rettype = go_func_return_ffi (func); status = ffi_prep_cif (cif, FFI_DEFAULT_ABI, num_args, rettype, args); @@ -511,9 +503,8 @@ go_set_results (const struct __go_func_type *func, unsigned char *call_result, regardless of FUNC_TYPE, it is passed as a pointer. If neither IS_INTERFACE nor IS_METHOD is true then we are calling a - function indirectly, and the caller is responsible for passing a - trailing closure argument, a pointer, which is not described in - FUNC_TYPE. */ + function indirectly, and we must pass a closure pointer via + __go_set_closure. The pointer to pass is simply FUNC_VAL. */ void reflect_call (const struct __go_func_type *func_type, FuncVal *func_val, @@ -528,6 +519,8 @@ reflect_call (const struct __go_func_type *func_type, FuncVal *func_val, call_result = (unsigned char *) malloc (go_results_size (func_type)); + if (!is_interface && !is_method) + __go_set_closure (func_val); ffi_call (&cif, func_val->fn, call_result, params); /* Some day we may need to free result values if RESULTS is diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c index 36afd2b964d..c3b32111ca0 100644 --- a/libgo/runtime/mgc0.c +++ b/libgo/runtime/mgc0.c @@ -2263,12 +2263,11 @@ runfinq(void* dummy __attribute__ ((unused))) for(; fb; fb=next) { next = fb->next; for(i=0; i<(uint32)fb->cnt; i++) { - void *params[2]; + void *param; f = &fb->fin[i]; - params[0] = &f->arg; - params[1] = f; - reflect_call(f->ft, f->fn, 0, 0, params, nil); + param = &f->arg; + reflect_call(f->ft, f->fn, 0, 0, ¶m, nil); f->fn = nil; f->arg = nil; } diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index d42ff3362ee..0e77a3e0603 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -2832,3 +2832,23 @@ runtime_proc_scan(void (*addroot)(Obj)) { addroot((Obj){(byte*)&runtime_sched, sizeof runtime_sched, 0}); } + +// When a function calls a closure, it passes the closure value to +// __go_set_closure immediately before the function call. When a +// function uses a closure, it calls __go_get_closure immediately on +// function entry. This is a hack, but it will work on any system. +// It would be better to use the static chain register when there is +// one. It is also worth considering expanding these functions +// directly in the compiler. + +void +__go_set_closure(void* v) +{ + g->closure = v; +} + +void * +__go_get_closure(void) +{ + return g->closure; +} diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 78fd388186a..d2e7d4c11bc 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -190,6 +190,7 @@ struct Location struct G { + void* closure; // Closure value. Defer* defer; Panic* panic; void* exception; // current exception being thrown @@ -759,3 +760,6 @@ extern void runtime_main(void*); int32 getproccount(void); #define PREFETCH(p) __builtin_prefetch(p) + +void __go_set_closure(void*); +void* __go_get_closure(void); diff --git a/libgo/runtime/time.goc b/libgo/runtime/time.goc index e06b75ccb3d..8d12fe01080 100644 --- a/libgo/runtime/time.goc +++ b/libgo/runtime/time.goc @@ -46,10 +46,9 @@ static void siftdown(int32); // Ready the goroutine e.data. static void -ready(int64 now, Eface e, void *closure) +ready(int64 now, Eface e) { USED(now); - USED(closure); runtime_ready(e.__object); } @@ -166,7 +165,7 @@ timerproc(void* dummy __attribute__ ((unused))) { int64 delta, now; Timer *t; - void (*f)(int64, Eface, void *); + void (*f)(int64, Eface); Eface arg; for(;;) { @@ -197,7 +196,8 @@ timerproc(void* dummy __attribute__ ((unused))) runtime_unlock(&timers); if(raceenabled) runtime_raceacquire(t); - f(now, arg, &t->fv); + __go_set_closure(t->fv); + f(now, arg); runtime_lock(&timers); } if(delta < 0) { -- cgit v1.2.3 From e59d37d18614738cf22235a483529745101e98a3 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 4 Sep 2013 00:16:29 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202236 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b24b9916fe4..c0a48555176 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130903 +20130904 -- cgit v1.2.3 From e04eb9b70050f8af0e09c6834dbcfb1f073e40d5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 4 Sep 2013 04:32:56 +0000 Subject: compiler: expand arguments with multiple results for built-in functions. Fixed https://code.google.com/p/go/issues/detail?id=5796. Official fixedbug will be added with change to gc. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202240 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 78a427398c2..0b010334229 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -9138,35 +9138,27 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, // Because do_type will return an error type and thus prevent future // errors, check for that case now to ensure that the error gets // reported. - if (this->get_function_type() == NULL) + Function_type* fntype = this->get_function_type(); + if (fntype == NULL) { if (!this->fn_->type()->is_error()) this->report_error(_("expected function")); return Expression::make_error(loc); } - // Recognize a call to a builtin function. - Func_expression* fne = this->fn_->func_expression(); - if (fne != NULL - && fne->named_object()->is_function_declaration() - && fne->named_object()->func_declaration_value()->type()->is_builtin()) - return new Builtin_call_expression(gogo, this->fn_, this->args_, - this->is_varargs_, loc); - // Handle an argument which is a call to a function which returns // multiple results. if (this->args_ != NULL && this->args_->size() == 1 - && this->args_->front()->call_expression() != NULL - && this->fn_->type()->function_type() != NULL) + && this->args_->front()->call_expression() != NULL) { - Function_type* fntype = this->fn_->type()->function_type(); size_t rc = this->args_->front()->call_expression()->result_count(); if (rc > 1 - && fntype->parameters() != NULL - && (fntype->parameters()->size() == rc - || (fntype->is_varargs() - && fntype->parameters()->size() - 1 <= rc))) + && ((fntype->parameters() != NULL + && (fntype->parameters()->size() == rc + || (fntype->is_varargs() + && fntype->parameters()->size() - 1 <= rc))) + || fntype->is_builtin())) { Call_expression* call = this->args_->front()->call_expression(); Expression_list* args = new Expression_list; @@ -9180,6 +9172,11 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, } } + // Recognize a call to a builtin function. + if (fntype->is_builtin()) + return new Builtin_call_expression(gogo, this->fn_, this->args_, + this->is_varargs_, loc); + // If this call returns multiple results, create a temporary // variable for each result. size_t rc = this->result_count(); @@ -9188,8 +9185,7 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, std::vector* temps = new std::vector; temps->reserve(rc); - const Typed_identifier_list* results = - this->fn_->type()->function_type()->results(); + const Typed_identifier_list* results = fntype->results(); for (Typed_identifier_list::const_iterator p = results->begin(); p != results->end(); ++p) @@ -9204,10 +9200,8 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, // Handle a call to a varargs function by packaging up the extra // parameters. - if (this->fn_->type()->function_type() != NULL - && this->fn_->type()->function_type()->is_varargs()) + if (fntype->is_varargs()) { - Function_type* fntype = this->fn_->type()->function_type(); const Typed_identifier_list* parameters = fntype->parameters(); go_assert(parameters != NULL && !parameters->empty()); Type* varargs_type = parameters->back().type(); -- cgit v1.2.3 From 25c1ed7cdac57044b4abf15c32e96502cf617733 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Wed, 4 Sep 2013 10:49:53 +0000 Subject: 2013-09-04 Matthias Klose * Makefile.am (libgcjgc_la_LIBADD): Add EXTRA_TEST_LIBS. * Makefile.in: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202246 138bc75d-0d04-0410-961f-82ee72b054a4 --- boehm-gc/ChangeLog | 5 +++++ boehm-gc/Makefile.am | 2 +- boehm-gc/Makefile.in | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index d4113d66477..fd7dfeb0b39 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-04 Matthias Klose + + * Makefile.am (libgcjgc_la_LIBADD): Add EXTRA_TEST_LIBS. + * Makefile.in: Regenerate. + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/boehm-gc/Makefile.am b/boehm-gc/Makefile.am index 40b103bd619..fa187ef31ee 100644 --- a/boehm-gc/Makefile.am +++ b/boehm-gc/Makefile.am @@ -35,7 +35,7 @@ sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s # Include THREADLIBS here to ensure that the correct versions of # linuxthread semaphore functions get linked: -libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) +libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) $(EXTRA_TEST_LIBS) libgcjgc_la_DEPENDENCIES = $(addobjs) libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir) libgcjgc_la_LINK = $(LINK) $(libgcjgc_la_LDFLAGS) diff --git a/boehm-gc/Makefile.in b/boehm-gc/Makefile.in index 02482269533..5fc84910128 100644 --- a/boehm-gc/Makefile.in +++ b/boehm-gc/Makefile.in @@ -280,7 +280,7 @@ sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s # Include THREADLIBS here to ensure that the correct versions of # linuxthread semaphore functions get linked: -libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) +libgcjgc_la_LIBADD = $(addobjs) $(THREADLIBS) $(EXTRA_TEST_LIBS) libgcjgc_la_DEPENDENCIES = $(addobjs) libgcjgc_la_LDFLAGS = $(extra_ldflags_libgc) -version-info 1:2:0 -rpath $(toolexeclibdir) libgcjgc_la_LINK = $(LINK) $(libgcjgc_la_LDFLAGS) -- cgit v1.2.3 From 0cfcbfb2b627438ea7aa7351f1a8d2df6a49bfaa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 5 Sep 2013 00:16:54 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202268 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c0a48555176..a892548556b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130904 +20130905 -- cgit v1.2.3 From 1067c3f5a708fdb7f37a94ba9f3372aaaf2ff946 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 6 Sep 2013 00:16:42 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202304 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a892548556b..1212ef65152 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130905 +20130906 -- cgit v1.2.3 From f99fdc3dc2fa3d26b611747f8caa8aa5c6489157 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 7 Sep 2013 00:16:25 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202349 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1212ef65152..5d18a12d2d3 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130906 +20130907 -- cgit v1.2.3 From 7fabb4bb9a8ca47ddc356db22aa6a0a284234fb4 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 7 Sep 2013 22:58:04 +0000 Subject: 2013-09-07 Paolo Carlini PR libstdc++/58341 * include/bits/stl_algobase.h (copy_backward): Fix documentation per DR 1206. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202358 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/stl_algobase.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b0a39696f83..9817f4226e0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2013-09-07 Paolo Carlini + + PR libstdc++/58341 + * include/bits/stl_algobase.h (copy_backward): Fix documentation + per DR 1206. + 2013-09-03 Paolo Carlini PR libstdc++/58302 diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index a90881f8f62..87dd171925c 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -611,7 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * loop count will be known (and therefore a candidate for compiler * optimizations such as unrolling). * - * Result may not be in the range [first,last). Use copy instead. Note + * Result may not be in the range (first,last]. Use copy instead. Note * that the start of the output range may overlap [first,last). */ template -- cgit v1.2.3 From 0e38e18540045c07b4e2dba39f34856a474b1454 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 8 Sep 2013 00:16:26 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202362 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5d18a12d2d3..7ccf4a5697d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130907 +20130908 -- cgit v1.2.3 From da0150c122f87e1f8356d8a6b25292ec77868be6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 9 Sep 2013 00:16:41 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202376 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7ccf4a5697d..6ee74275c1d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130908 +20130909 -- cgit v1.2.3 From d90be0b97ba858c1db4764bf14208eb05f76466a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Sep 2013 09:47:24 +0000 Subject: 2013-09-09 Richard Biener Backport from mainline 2013-08-30 Richard Biener PR tree-optimization/58223 * tree-loop-distribution.c (has_anti_dependence): Rename to ... (has_anti_or_output_dependence): ... this and adjust to also look for output dependences. (mark_nodes_having_upstream_mem_writes): Adjust. (rdg_flag_uses): Likewise. * gcc.dg/torture/pr58223.c: New testcase. * gcc.dg/tree-ssa/ldist-16.c: Flip expected behavior. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202385 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.dg/torture/pr58223.c | 16 ++++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c | 6 +++--- gcc/tree-loop-distribution.c | 21 +++++++++++---------- 5 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58223.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7bb657b0c16..d7946269915 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58223 + * tree-loop-distribution.c (has_anti_dependence): Rename to ... + (has_anti_or_output_dependence): ... this and adjust to also + look for output dependences. + (mark_nodes_having_upstream_mem_writes): Adjust. + (rdg_flag_uses): Likewise. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5310a66c3d0..0023ecff833 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-30 Richard Biener + + PR tree-optimization/58223 + * gcc.dg/torture/pr58223.c: New testcase. + * gcc.dg/tree-ssa/ldist-16.c: Flip expected behavior. + 2013-09-03 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr58223.c b/gcc/testsuite/gcc.dg/torture/pr58223.c new file mode 100644 index 00000000000..978084ad0dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58223.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ + +extern void abort (void); +int a[2], b; + +int main () +{ + for (b = 0; b < 2; b++) + { + a[0] = 1; + a[b] = 0; + } + if (a[0] != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c index a26999e8905..53a9fa4f9e3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-16.c @@ -14,8 +14,8 @@ void foo (int n) } } -/* We should apply loop distribution and generate a memset (0). */ +/* We should not apply loop distribution and not generate a memset (0). */ -/* { dg-final { scan-tree-dump "distributed: split to 2" "ldist" } } */ -/* { dg-final { scan-tree-dump-times "generated memset zero" 1 "ldist" } } */ +/* { dg-final { scan-tree-dump "Loop 1 is the same" "ldist" } } */ +/* { dg-final { scan-tree-dump-times "generated memset zero" 0 "ldist" } } */ /* { dg-final { cleanup-tree-dump "ldist" } } */ diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 101efbed0a5..619d93cb891 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -518,17 +518,19 @@ already_processed_vertex_p (bitmap processed, int v) || !bitmap_bit_p (remaining_stmts, v)); } -/* Returns NULL when there is no anti-dependence among the successors - of vertex V, otherwise returns the edge with the anti-dep. */ +/* Returns NULL when there is no anti-dependence or output-dependence + among the successors of vertex V, otherwise returns the edge with the + dependency. */ static struct graph_edge * -has_anti_dependence (struct vertex *v) +has_anti_or_output_dependence (struct vertex *v) { struct graph_edge *e; if (v->succ) for (e = v->succ; e; e = e->succ_next) - if (RDGE_TYPE (e) == anti_dd) + if (RDGE_TYPE (e) == anti_dd + || RDGE_TYPE (e) == output_dd) return e; return NULL; @@ -580,11 +582,10 @@ mark_nodes_having_upstream_mem_writes (struct graph *rdg) || predecessor_has_mem_write (rdg, &(rdg->vertices[x])) /* In anti dependences the read should occur before the write, this is why both the read and the write - should be placed in the same partition. */ - || has_anti_dependence (&(rdg->vertices[x]))) - { - bitmap_set_bit (upstream_mem_writes, x); - } + should be placed in the same partition. In output + dependences the writes order need to be preserved. */ + || has_anti_or_output_dependence (&(rdg->vertices[x]))) + bitmap_set_bit (upstream_mem_writes, x); } nodes.release (); @@ -613,7 +614,7 @@ rdg_flag_uses (struct graph *rdg, int u, partition_t partition, bitmap loops, use_operand_p use_p; struct vertex *x = &(rdg->vertices[u]); gimple stmt = RDGV_STMT (x); - struct graph_edge *anti_dep = has_anti_dependence (x); + struct graph_edge *anti_dep = has_anti_or_output_dependence (x); /* Keep in the same partition the destination of an antidependence, because this is a store to the exact same location. Putting this -- cgit v1.2.3 From 03e039ddec31df4e8d3cbc2d9eed78c2731361d9 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Sep 2013 09:48:43 +0000 Subject: 2013-09-09 Richard Biener Backport from mainline 2013-08-29 Richard Biener PR tree-optimization/57685 * tree-vrp.c (register_edge_assert_for_1): Recurse only for single-use operands to avoid exponential complexity. * gcc.dg/torture/pr57685.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202386 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr57685.c | 15 +++++++++++++++ gcc/tree-vrp.c | 12 ++++++++---- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57685.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7946269915..b7c722c259e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-29 Richard Biener + + PR tree-optimization/57685 + * tree-vrp.c (register_edge_assert_for_1): Recurse only for + single-use operands to avoid exponential complexity. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0023ecff833..430b945a003 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-29 Richard Biener + + PR tree-optimization/57685 + * gcc.dg/torture/pr57685.c: New testcase. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr57685.c b/gcc/testsuite/gcc.dg/torture/pr57685.c new file mode 100644 index 00000000000..75973f2a493 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57685.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +unsigned f(void) +{ + unsigned a; + int b, c, d, e; + + for(c = 27; c < 40; c++) + b |= d |= b; + + if(b) + a = e; + + return a; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 0b8fdf9889c..a8caed60360 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -5246,10 +5246,14 @@ register_edge_assert_for_1 (tree op, enum tree_code code, && gimple_assign_rhs_code (op_def) == BIT_IOR_EXPR)) { /* Recurse on each operand. */ - retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def), - code, e, bsi); - retval |= register_edge_assert_for_1 (gimple_assign_rhs2 (op_def), - code, e, bsi); + tree op0 = gimple_assign_rhs1 (op_def); + tree op1 = gimple_assign_rhs2 (op_def); + if (TREE_CODE (op0) == SSA_NAME + && has_single_use (op0)) + retval |= register_edge_assert_for_1 (op0, code, e, bsi); + if (TREE_CODE (op1) == SSA_NAME + && has_single_use (op1)) + retval |= register_edge_assert_for_1 (op1, code, e, bsi); } else if (gimple_assign_rhs_code (op_def) == BIT_NOT_EXPR && TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (op_def))) == 1) -- cgit v1.2.3 From f6f95f5e9f1059b571a0c6d2fd9bb53f046f0234 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Sep 2013 09:49:54 +0000 Subject: 2013-09-09 Richard Biener Backport from mainline 2013-09-03 Richard Biener PR middle-end/57656 * fold-const.c (negate_expr_p): Fix division case. (negate_expr): Likewise. * gcc.dg/torture/pr57656.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202387 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++ gcc/fold-const.c | 45 +++++++++++++++++++++++----------- gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gcc.dg/torture/pr57656.c | 13 ++++++++++ 4 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57656.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7c722c259e..5f7e025a98e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-09-03 Richard Biener + + PR middle-end/57656 + * fold-const.c (negate_expr_p): Fix division case. + (negate_expr): Likewise. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5e3486373d0..4b66c6d70b7 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -469,11 +469,24 @@ negate_expr_p (tree t) and actually traps on some architectures. But if overflow is undefined, we can negate, because - (INT_MIN / 1) is an overflow. */ - if (INTEGRAL_TYPE_P (TREE_TYPE (t)) - && !TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t))) - break; - return negate_expr_p (TREE_OPERAND (t, 1)) - || negate_expr_p (TREE_OPERAND (t, 0)); + if (INTEGRAL_TYPE_P (TREE_TYPE (t))) + { + if (!TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (t))) + break; + /* If overflow is undefined then we have to be careful because + we ask whether it's ok to associate the negate with the + division which is not ok for example for + -((a - b) / c) where (-(a - b)) / c may invoke undefined + overflow because of negating INT_MIN. So do not use + negate_expr_p here but open-code the two important cases. */ + if (TREE_CODE (TREE_OPERAND (t, 0)) == NEGATE_EXPR + || (TREE_CODE (TREE_OPERAND (t, 0)) == INTEGER_CST + && may_negate_without_overflow_p (TREE_OPERAND (t, 0)))) + return true; + } + else if (negate_expr_p (TREE_OPERAND (t, 0))) + return true; + return negate_expr_p (TREE_OPERAND (t, 1)); case NOP_EXPR: /* Negate -((double)float) as (double)(-float). */ @@ -653,16 +666,20 @@ fold_negate_expr (location_t loc, tree t) return fold_build2_loc (loc, TREE_CODE (t), type, TREE_OPERAND (t, 0), negate_expr (tem)); } + /* If overflow is undefined then we have to be careful because + we ask whether it's ok to associate the negate with the + division which is not ok for example for + -((a - b) / c) where (-(a - b)) / c may invoke undefined + overflow because of negating INT_MIN. So do not use + negate_expr_p here but open-code the two important cases. */ tem = TREE_OPERAND (t, 0); - if (negate_expr_p (tem)) - { - if (INTEGRAL_TYPE_P (type) - && (TREE_CODE (tem) != INTEGER_CST - || tree_int_cst_equal (tem, TYPE_MIN_VALUE (type)))) - fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_MISC); - return fold_build2_loc (loc, TREE_CODE (t), type, - negate_expr (tem), TREE_OPERAND (t, 1)); - } + if ((INTEGRAL_TYPE_P (type) + && (TREE_CODE (tem) == NEGATE_EXPR + || (TREE_CODE (tem) == INTEGER_CST + && may_negate_without_overflow_p (tem)))) + || !INTEGRAL_TYPE_P (type)) + return fold_build2_loc (loc, TREE_CODE (t), type, + negate_expr (tem), TREE_OPERAND (t, 1)); } break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 430b945a003..a9f1c6b9b22 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-09-03 Richard Biener + + PR middle-end/57656 + * gcc.dg/torture/pr57656.c: New testcase. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr57656.c b/gcc/testsuite/gcc.dg/torture/pr57656.c new file mode 100644 index 00000000000..4f3645e4693 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57656.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-overflow" } */ + +int main (void) +{ + int a = -1; + int b = __INT_MAX__; + int c = 2; + int t = 1 - ((a - b) / c); // t = 1 - ( __INT_MIN__ / 2 ) + if (t != (1 - (-1 - __INT_MAX__) / 2)) + __builtin_abort(); + return 0; +} -- cgit v1.2.3 From c972eab35cb470296b243cc06370c0a31b21be22 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 9 Sep 2013 09:51:18 +0000 Subject: 2013-09-09 Richard Biener Backport from mainline 2013-08-27 Richard Biener PR tree-optimization/57521 * tree-if-conv.c (if_convertible_bb_p): Verify that at least one edge is non-critical. (find_phi_replacement_condition): Make sure to use a non-critical edge. Cleanup and remove old bug workarounds. (bb_postdominates_preds): Remove. (if_convertible_loop_p_1): Do not compute post-dominators. (combine_blocks): Do not free post-dominators. (main_tree_if_conversion): Likewise. * gcc.dg/torture/pr57521.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202388 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 15 ++++++ gcc/testsuite/ChangeLog | 8 ++++ gcc/testsuite/gcc.dg/torture/pr57521.c | 51 ++++++++++++++++++++ gcc/tree-if-conv.c | 85 ++++++++++------------------------ 4 files changed, 98 insertions(+), 61 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57521.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5f7e025a98e..16132ef764b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-27 Richard Biener + + PR tree-optimization/57521 + * tree-if-conv.c (if_convertible_bb_p): Verify that at least + one edge is non-critical. + (find_phi_replacement_condition): Make sure to use a non-critical + edge. Cleanup and remove old bug workarounds. + (bb_postdominates_preds): Remove. + (if_convertible_loop_p_1): Do not compute post-dominators. + (combine_blocks): Do not free post-dominators. + (main_tree_if_conversion): Likewise. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9f1c6b9b22..1821958fc88 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-09-09 Richard Biener + + Backport from mainline + 2013-08-27 Richard Biener + + PR tree-optimization/57521 + * gcc.dg/torture/pr57521.c: New testcase. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr57521.c b/gcc/testsuite/gcc.dg/torture/pr57521.c new file mode 100644 index 00000000000..e7832cb00e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57521.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-ftree-loop-if-convert" } */ + +void abort (void); + +int a, b, c, d, o = 1, p; +short e; + +int +fn1 (int * p1) +{ + int f, g, h, j = 0, k = 0, l = 0; + unsigned int i; + int *m[1] = { &l }; + for (; b >= 0; b--) + { + if (*p1) + if (j >= 0) + { + int n = 1; + e = 1; + h = a ? a : 1 % n; + g = h > 0 ? 0 : h + 1; + k = c + g; + } + else + continue; + else + { + + f = d > 0 ? 0 : d + 1; + i = f; + j = 1 + i; + } + l++; + } + return k; +} + +int +main () +{ + for (;; p++) + { + fn1 (&o); + break; + } + if (e != 1) + abort (); + return 0; +} diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 95d0394fc51..a2cb82d3920 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -797,20 +797,6 @@ if_convertible_stmt_p (gimple stmt, vec refs) return true; } -/* Return true when BB post-dominates all its predecessors. */ - -static bool -bb_postdominates_preds (basic_block bb) -{ - unsigned i; - - for (i = 0; i < EDGE_COUNT (bb->preds); i++) - if (!dominated_by_p (CDI_POST_DOMINATORS, EDGE_PRED (bb, i)->src, bb)) - return false; - - return true; -} - /* Return true when BB is if-convertible. This routine does not check basic block's statements and phis. @@ -868,10 +854,23 @@ if_convertible_bb_p (struct loop *loop, basic_block bb, basic_block exit_bb) return false; } - if (EDGE_COUNT (bb->preds) == 2 - && bb != loop->header - && !bb_postdominates_preds (bb)) - return false; + /* At least one incoming edge has to be non-critical as otherwise edge + predicates are not equal to basic-block predicates of the edge + source. */ + if (EDGE_COUNT (bb->preds) > 1 + && bb != loop->header) + { + bool found = false; + FOR_EACH_EDGE (e, ei, bb->preds) + if (EDGE_COUNT (e->src->succs) == 1) + found = true; + if (!found) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "only critical predecessors\n"); + return false; + } + } return true; } @@ -1084,7 +1083,6 @@ if_convertible_loop_p_1 (struct loop *loop, return false; calculate_dominance_info (CDI_DOMINATORS); - calculate_dominance_info (CDI_POST_DOMINATORS); /* Allow statements that can be handled during if-conversion. */ ifc_bbs = get_loop_body_in_if_conv_order (loop); @@ -1220,8 +1218,7 @@ if_convertible_loop_p (struct loop *loop) if-conversion. */ static basic_block -find_phi_replacement_condition (struct loop *loop, - basic_block bb, tree *cond, +find_phi_replacement_condition (basic_block bb, tree *cond, gimple_stmt_iterator *gsi) { edge first_edge, second_edge; @@ -1231,34 +1228,10 @@ find_phi_replacement_condition (struct loop *loop, first_edge = EDGE_PRED (bb, 0); second_edge = EDGE_PRED (bb, 1); - /* Use condition based on following criteria: - 1) - S1: x = !c ? a : b; - - S2: x = c ? b : a; - - S2 is preferred over S1. Make 'b' first_bb and use its condition. - - 2) Do not make loop header first_bb. - - 3) - S1: x = !(c == d)? a : b; - - S21: t1 = c == d; - S22: x = t1 ? b : a; - - S3: x = (c == d) ? b : a; - - S3 is preferred over S1 and S2*, Make 'b' first_bb and use - its condition. - - 4) If pred B is dominated by pred A then use pred B's condition. - See PR23115. */ - - /* Select condition that is not TRUTH_NOT_EXPR. */ + /* Prefer an edge with a not negated predicate. + ??? That's a very weak cost model. */ tmp_cond = bb_predicate (first_edge->src); gcc_assert (tmp_cond); - if (TREE_CODE (tmp_cond) == TRUTH_NOT_EXPR) { edge tmp_edge; @@ -1268,11 +1241,9 @@ find_phi_replacement_condition (struct loop *loop, second_edge = tmp_edge; } - /* Check if FIRST_BB is loop header or not and make sure that - FIRST_BB does not dominate SECOND_BB. */ - if (first_edge->src == loop->header - || dominated_by_p (CDI_DOMINATORS, - second_edge->src, first_edge->src)) + /* Check if the edge we take the condition from is not critical. + We know that at least one non-critical edge exists. */ + if (EDGE_COUNT (first_edge->src->succs) > 1) { *cond = bb_predicate (second_edge->src); @@ -1347,9 +1318,6 @@ predicate_scalar_phi (gimple phi, tree cond, arg_1 = gimple_phi_arg_def (phi, 1); } - gcc_checking_assert (bb == bb->loop_father->header - || bb_postdominates_preds (bb)); - /* Build new RHS using selected condition and arguments. */ rhs = fold_build_cond_expr (TREE_TYPE (res), unshare_expr (cond), arg_0, arg_1); @@ -1395,7 +1363,7 @@ predicate_all_scalar_phis (struct loop *loop) /* BB has two predecessors. Using predecessor's aux field, set appropriate condition for the PHI node replacement. */ gsi = gsi_after_labels (bb); - true_bb = find_phi_replacement_condition (loop, bb, &cond, &gsi); + true_bb = find_phi_replacement_condition (bb, &cond, &gsi); while (!gsi_end_p (phi_gsi)) { @@ -1765,9 +1733,6 @@ combine_blocks (struct loop *loop) free (ifc_bbs); ifc_bbs = NULL; - - /* Post-dominators are corrupt now. */ - free_dominance_info (CDI_POST_DOMINATORS); } /* If-convert LOOP when it is legal. For the moment this pass has no @@ -1830,8 +1795,6 @@ main_tree_if_conversion (void) if (changed && flag_tree_loop_if_convert_stores) todo |= TODO_update_ssa_only_virtuals; - free_dominance_info (CDI_POST_DOMINATORS); - #ifdef ENABLE_CHECKING { basic_block bb; -- cgit v1.2.3 From 54809bc27d939bf8b55c6dce3dc65ff9c38d45f0 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Mon, 9 Sep 2013 13:11:45 +0000 Subject: [gcc/] 2013-09-09 Kyrylo Tkachov PR target/57735 Backport from mainline 2013-04-30 Richard Sandiford * explow.c (plus_constant): Pass "mode" to immed_double_int_const. Use gen_int_mode rather than GEN_INT. [gcc/testsuite] 2013-09-09 Kyrylo Tkachov PR target/57735 * g++.dg/ext/pr57735.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202397 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++ gcc/explow.c | 6 +- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/ext/pr57735.C | 145 +++++++++++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/pr57735.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 16132ef764b..5be6a0d8756 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-09 Kyrylo Tkachov + + PR target/57735 + Backport from mainline + 2013-04-30 Richard Sandiford + + * explow.c (plus_constant): Pass "mode" to immed_double_int_const. + Use gen_int_mode rather than GEN_INT. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/explow.c b/gcc/explow.c index 08a66537b90..7da8bc75f19 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -106,10 +106,10 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c) if (overflow) gcc_unreachable (); - return immed_double_int_const (v, VOIDmode); + return immed_double_int_const (v, mode); } - return GEN_INT (INTVAL (x) + c); + return gen_int_mode (INTVAL (x) + c, mode); case CONST_DOUBLE: { @@ -124,7 +124,7 @@ plus_constant (enum machine_mode mode, rtx x, HOST_WIDE_INT c) To fix, add constant support wider than CONST_DOUBLE. */ gcc_assert (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_DOUBLE_INT); - return immed_double_int_const (v, VOIDmode); + return immed_double_int_const (v, mode); } case MEM: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1821958fc88..ce1f52fd7fc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-09 Kyrylo Tkachov + + PR target/57735 + * g++.dg/ext/pr57735.C: New test. + 2013-09-09 Richard Biener Backport from mainline diff --git a/gcc/testsuite/g++.dg/ext/pr57735.C b/gcc/testsuite/g++.dg/ext/pr57735.C new file mode 100644 index 00000000000..0eb95006dda --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pr57735.C @@ -0,0 +1,145 @@ +/* { dg-do compile { target arm*-*-* } } */ +/* { dg-options "-march=armv5te -marm -mtune=xscale -mfloat-abi=soft -O1" } */ + +typedef unsigned int size_t; +__extension__ +typedef long long int int64_t; +namespace WTF { + template class RefPtr { + public: + inline T* operator->() const { return m_ptr; } + T* m_ptr; + }; +} +using WTF::RefPtr; +namespace JSC { + class ExecState; + class JSString; + typedef int64_t EncodedJSValue; + class JSValue { + public: + static EncodedJSValue encode(JSValue); + JSString* toString(ExecState*) const; + }; +} +typedef unsigned char LChar; + typedef short unsigned int UChar; +namespace WTF { + template + class Vector { + public: + template bool tryAppend(const U*, size_t); + }; +} +using WTF::Vector; +namespace WTF { +template inline bool isASCIIDigit(CharType c) +{ +} +template inline bool isASCIIHexDigit(CharType c) +{ + return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); +} + class StringImpl; +} +using WTF::StringImpl; +namespace WTF { +class StringImpl { +public: + unsigned length() const { return m_length; } + unsigned m_length; +}; +} +namespace JSC { + class Register { + }; +class UString { +public: + unsigned length() const + { + return m_impl->length(); + } + const LChar* characters8() const + { + } + RefPtr m_impl; +}; + class ExecState : private Register { + public: + JSValue argument(size_t argument) + { + } + }; + class JSCell { + }; + class JSString : public JSCell { + public: + const UString& value(ExecState*) const; + }; +class JSStringBuilder { +public: + void append(const UChar u) + { + m_okay &= buffer16.tryAppend(&u, 1); + } + Vector buffer16; + bool m_okay; +}; +template +class Lexer { +public: + static unsigned char convertHex(int c1, int c2); +}; +} +namespace WTF { +namespace Unicode { + int UTF8SequenceLength(char); + int decodeUTF8Sequence(const char*); +} +} +using namespace WTF; +using namespace Unicode; +namespace JSC { +template +static JSValue decode(ExecState* exec, const CharType* characters, int length, const char* doNotUnescape, bool strict) +{ + JSStringBuilder builder; + int k = 0; + UChar u = 0; + while (k < length) { + const CharType* p = characters + k; + CharType c = *p; + if (c == '%') { + int charLen = 0; + if (k <= length - 3 && isASCIIHexDigit(p[1]) && isASCIIHexDigit(p[2])) { + const char b0 = Lexer::convertHex(p[1], p[2]); + const int sequenceLen = UTF8SequenceLength(b0); + if (sequenceLen && k <= length - sequenceLen * 3) { + charLen = sequenceLen * 3; + char sequence[5]; + if (charLen != 0) { + const int character = decodeUTF8Sequence(sequence); + if (character < 0 || character >= 0x110000) + charLen = 0; + else if (character >= 0x10000) { + builder.append(static_cast(0xD800 | ((character - 0x10000) >> 10))); + } else + u = static_cast(character); + } + } + } + } + } +} +static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict) +{ + UString str = exec->argument(0).toString(exec)->value(exec); + return decode(exec, str.characters8(), str.length(), doNotUnescape, strict); +} +EncodedJSValue globalFuncDecodeURI(ExecState* exec) +{ + static const char do_not_unescape_when_decoding_URI[] = + "#$&+,/:;=?@"; + return JSValue::encode(decode(exec, do_not_unescape_when_decoding_URI, true)); +} +} -- cgit v1.2.3 From 3cb04d85e61c195c2ebe17ba86a0929c26565970 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 9 Sep 2013 17:11:05 +0000 Subject: PR tree-optimization/58364 * tree-ssa-reassoc.c (init_range_entry): For BIT_NOT_EXPR on BOOLEAN_TYPE, only invert in_p and continue with arg0 if the current range can't be an unconditional true or false. * gcc.c-torture/execute/pr58364.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202410 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr58364.c | 17 +++++++++++++++++ gcc/tree-ssa-reassoc.c | 9 ++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58364.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5be6a0d8756..6fa4c22038f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-09 Jakub Jelinek + + PR tree-optimization/58364 + * tree-ssa-reassoc.c (init_range_entry): For BIT_NOT_EXPR on + BOOLEAN_TYPE, only invert in_p and continue with arg0 if + the current range can't be an unconditional true or false. + 2013-09-09 Kyrylo Tkachov PR target/57735 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce1f52fd7fc..f13c50e826d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-09 Jakub Jelinek + + PR tree-optimization/58364 + * gcc.c-torture/execute/pr58364.c: New test. + 2013-09-09 Kyrylo Tkachov PR target/57735 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58364.c b/gcc/testsuite/gcc.c-torture/execute/pr58364.c new file mode 100644 index 00000000000..59ad7b47a16 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58364.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/58364 */ + +int a = 1, b, c; + +int +foo (int x) +{ + return x < 0 ? 1 : x; +} + +int +main () +{ + if (foo (a > c == (b = 0))) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 46994389e16..a1a9a7319fe 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1774,7 +1774,14 @@ init_range_entry (struct range_entry *r, tree exp, gimple stmt) switch (code) { case BIT_NOT_EXPR: - if (TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE) + if (TREE_CODE (TREE_TYPE (exp)) == BOOLEAN_TYPE + /* Ensure the range is either +[-,0], +[0,0], + -[-,0], -[0,0] or +[1,-], +[1,1], -[1,-] or + -[1,1]. If it is e.g. +[-,-] or -[-,-] + or similar expression of unconditional true or + false, it should not be negated. */ + && ((high && integer_zerop (high)) + || (low && integer_onep (low)))) { in_p = !in_p; exp = arg0; -- cgit v1.2.3 From 428b7ad606b6d0c3812e55fb2266edf7d073f4ee Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 9 Sep 2013 17:12:50 +0000 Subject: PR c++/58325 * init.c (build_vec_delete): Call mark_rvalue_use on base. * g++.dg/warn/Wunused-var-21.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202412 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/init.c | 1 + gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/warn/Wunused-var-21.C | 31 ++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/Wunused-var-21.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5dc49e9627..ed11a5d3e0c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-09-09 Jakub Jelinek + + PR c++/58325 + * init.c (build_vec_delete): Call mark_rvalue_use on base. + 2013-08-20 Jason Merrill PR c++/58119 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6f3196a3a9c..ea40caa8f64 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -4064,6 +4064,7 @@ build_vec_delete (tree base, tree maxindex, tree cookie_addr; tree size_ptr_type = build_pointer_type (sizetype); + base = mark_rvalue_use (base); if (TREE_SIDE_EFFECTS (base)) { base_init = get_target_expr (base); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f13c50e826d..7237f05985e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-09-09 Jakub Jelinek + PR c++/58325 + * g++.dg/warn/Wunused-var-21.C: New test. + PR tree-optimization/58364 * gcc.c-torture/execute/pr58364.c: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-21.C b/gcc/testsuite/g++.dg/warn/Wunused-var-21.C new file mode 100644 index 00000000000..d279e598033 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-var-21.C @@ -0,0 +1,31 @@ +// PR c++/58325 +// { dg-do compile } +// { dg-options "-Wunused" } + +void +f1 () +{ + int *volatile a = new int[1]; + delete[] a; +} + +void +f2 () +{ + int *b = new int[1]; + delete[] b; +} + +void +f3 () +{ + int *volatile c = new int; + delete c; +} + +void +f4 () +{ + int *d = new int; + delete d; +} -- cgit v1.2.3 From 11c8b0fa3cf859ab0dc78631bd157817e43a218c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 10 Sep 2013 00:16:28 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202420 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6ee74275c1d..48a3cc43241 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130909 +20130910 -- cgit v1.2.3 From dace5132d1f4e39c438d13915cded8cc096ad415 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 10 Sep 2013 11:48:30 +0000 Subject: PR rtl-optimization/58365 * cfgcleanup.c (merge_memattrs): Also clear MEM_READONLY_P resp. MEM_NOTRAP_P if they differ, or set MEM_VOLATILE_P if it differs. * gcc.c-torture/execute/pr58365.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202435 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 ++++++ gcc/cfgcleanup.c | 18 ++++++++++++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.c-torture/execute/pr58365.c | 35 +++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58365.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6fa4c22038f..2377640e57a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-10 Jakub Jelinek + + PR rtl-optimization/58365 + * cfgcleanup.c (merge_memattrs): Also clear MEM_READONLY_P + resp. MEM_NOTRAP_P if they differ, or set MEM_VOLATILE_P if + it differs. + 2013-09-09 Jakub Jelinek PR tree-optimization/58364 diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 471d293f12f..8a120bf90a6 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -927,6 +927,24 @@ merge_memattrs (rtx x, rtx y) set_mem_align (y, MEM_ALIGN (x)); } } + if (code == MEM) + { + if (MEM_READONLY_P (x) != MEM_READONLY_P (y)) + { + MEM_READONLY_P (x) = 0; + MEM_READONLY_P (y) = 0; + } + if (MEM_NOTRAP_P (x) != MEM_NOTRAP_P (y)) + { + MEM_NOTRAP_P (x) = 0; + MEM_NOTRAP_P (y) = 0; + } + if (MEM_VOLATILE_P (x) != MEM_VOLATILE_P (y)) + { + MEM_VOLATILE_P (x) = 1; + MEM_VOLATILE_P (y) = 1; + } + } fmt = GET_RTX_FORMAT (code); for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7237f05985e..9e8d099ee27 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-10 Jakub Jelinek + + PR rtl-optimization/58365 + * gcc.c-torture/execute/pr58365.c: New test. + 2013-09-09 Jakub Jelinek PR c++/58325 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58365.c b/gcc/testsuite/gcc.c-torture/execute/pr58365.c new file mode 100644 index 00000000000..1e6079d8429 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58365.c @@ -0,0 +1,35 @@ +/* PR rtl-optimization/58365 */ + +extern void abort (void); + +struct S +{ + volatile int a; + int b, c, d, e; +} f; +static struct S g, h; +int i = 1; + +char +foo (void) +{ + return i; +} + +static struct S +bar (void) +{ + if (foo ()) + return f; + return g; +} + +int +main () +{ + h = bar (); + f.b = 1; + if (h.b != 0) + abort (); + return 0; +} -- cgit v1.2.3 From e79a794d2af213778cd98fb8a73ef762cf5d7d97 Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Tue, 10 Sep 2013 16:19:45 +0000 Subject: Backport from trunk. PR libstdc++/54314 * config/abi/pre/gnu-versioned-namespace.ver: Add thunk _ZTv0_n12_NS* like in gnu.ver. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202474 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver | 1 + 2 files changed, 8 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9817f4226e0..04f1589936c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2013-09-10 Kai Tietz + + Backport from trunk. + PR libstdc++/54314 + * config/abi/pre/gnu-versioned-namespace.ver: Add thunk _ZTv0_n12_NS* + like in gnu.ver. + 2013-09-07 Paolo Carlini PR libstdc++/58341 diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver index 7880767af68..ccbdc283166 100644 --- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver +++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver @@ -63,6 +63,7 @@ GLIBCXX_7.0 { _ZTVN9__gnu_cxx3__718stdio_sync_filebufI[cw]NSt3__711char_traitsI[cw]EEEE; # thunk + _ZTv0_n12_NS*; _ZTv0_n24_NS*; # typeinfo structure -- cgit v1.2.3 From 2bcc3e36c7b6b0140470f3688a55f6443fa74448 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Tue, 10 Sep 2013 16:53:15 +0000 Subject: PR target/58361 * arm/vfp.md (combine_vcvt_f32_): Fix pattern to support conditional execution. (combine_vcvt_f64_): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202476 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/config/arm/vfp.md | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2377640e57a..feeb59eeaf0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-10 Richard Earnshaw + + PR target/58361 + * arm/vfp.md (combine_vcvt_f32_): Fix pattern to + support conditional execution. + (combine_vcvt_f64_): Likewise. + 2013-09-10 Jakub Jelinek PR rtl-optimization/58365 diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md index 923624ffc6f..10e271ae513 100644 --- a/gcc/config/arm/vfp.md +++ b/gcc/config/arm/vfp.md @@ -1207,18 +1207,18 @@ (set_attr "type" "fcmpd")] ) -;; Fixed point to floating point conversions. +;; Fixed point to floating point conversions. (define_code_iterator FCVT [unsigned_float float]) (define_code_attr FCVTI32typename [(unsigned_float "u32") (float "s32")]) (define_insn "*combine_vcvt_f32_" [(set (match_operand:SF 0 "s_register_operand" "=t") (mult:SF (FCVT:SF (match_operand:SI 1 "s_register_operand" "0")) - (match_operand 2 + (match_operand 2 "const_double_vcvt_power_of_two_reciprocal" "Dt")))] "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math" - "vcvt.f32.\\t%0, %1, %v2" - [(set_attr "predicable" "no") + "vcvt%?.f32.\\t%0, %1, %v2" + [(set_attr "predicable" "yes") (set_attr "type" "f_cvt")] ) @@ -1227,15 +1227,16 @@ (define_insn "*combine_vcvt_f64_" [(set (match_operand:DF 0 "s_register_operand" "=x,x,w") (mult:DF (FCVT:DF (match_operand:SI 1 "s_register_operand" "r,t,r")) - (match_operand 2 + (match_operand 2 "const_double_vcvt_power_of_two_reciprocal" "Dt,Dt,Dt")))] - "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math + "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math && !TARGET_VFP_SINGLE" "@ - vmov.f32\\t%0, %1\;vcvt.f64.\\t%P0, %P0, %v2 - vmov.f32\\t%0, %1\;vcvt.f64.\\t%P0, %P0, %v2 - vmov.f64\\t%P0, %1, %1\;vcvt.f64.\\t%P0, %P0, %v2" - [(set_attr "predicable" "no") + vmov%?.f32\\t%0, %1\;vcvt%?.f64.\\t%P0, %P0, %v2 + vmov%?.f32\\t%0, %1\;vcvt%?.f64.\\t%P0, %P0, %v2 + vmov%?.f64\\t%P0, %1, %1\;vcvt%?.f64.\\t%P0, %P0, %v2" + [(set_attr "predicable" "yes") + (set_attr "ce_count" "2") (set_attr "type" "f_cvt") (set_attr "length" "8")] ) -- cgit v1.2.3 From 65f8d28cc5318560fccf4da53d38a5dc041f8e4b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 11 Sep 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202485 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 48a3cc43241..5782b96000b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130910 +20130911 -- cgit v1.2.3 From e7c80d7823ebd39da7592c20316dfd1cc4ce2bfe Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 11 Sep 2013 12:17:47 +0000 Subject: PR tree-optimization/58385 * fold-const.c (build_range_check): If both low and high are NULL, use omit_one_operand_loc to preserve exp side-effects. * gcc.c-torture/execute/pr58385.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202495 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr58385.c | 21 +++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58385.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index feeb59eeaf0..bb6f1c7c32f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-11 Jakub Jelinek + + PR tree-optimization/58385 + * fold-const.c (build_range_check): If both low and high are NULL, + use omit_one_operand_loc to preserve exp side-effects. + 2013-09-10 Richard Earnshaw PR target/58361 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4b66c6d70b7..e2da77c07fc 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4237,7 +4237,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, } if (low == 0 && high == 0) - return build_int_cst (type, 1); + return omit_one_operand_loc (loc, type, build_int_cst (type, 1), exp); if (low == 0) return fold_build2_loc (loc, LE_EXPR, type, exp, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e8d099ee27..8e963bc99f7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-11 Jakub Jelinek + + PR tree-optimization/58385 + * gcc.c-torture/execute/pr58385.c: New test. + 2013-09-10 Jakub Jelinek PR rtl-optimization/58365 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58385.c b/gcc/testsuite/gcc.c-torture/execute/pr58385.c new file mode 100644 index 00000000000..8d7da6fc972 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58385.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/58385 */ + +extern void abort (void); + +int a, b = 1; + +int +foo () +{ + b = 0; + return 0; +} + +int +main () +{ + ((0 || a) & foo () >= 0) <= 1 && 1; + if (b) + abort (); + return 0; +} -- cgit v1.2.3 From 3183cf9508b95160a0f8faa5c793c242cad22979 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 11 Sep 2013 12:23:15 +0000 Subject: 2013-09-11 Richard Biener PR middle-end/58377 * passes.c (init_optimization_passes): Split critical edges before late uninit warning pass in the -Og pipeline. * g++.dg/uninit-pred-4.C: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202498 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/passes.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/uninit-pred-4.C | 16 ++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/uninit-pred-4.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb6f1c7c32f..f346c0cbc99 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-11 Richard Biener + + PR middle-end/58377 + * passes.c (init_optimization_passes): Split critical edges + before late uninit warning pass in the -Og pipeline. + 2013-09-11 Jakub Jelinek PR tree-optimization/58385 diff --git a/gcc/passes.c b/gcc/passes.c index 7085f5d247f..61f8a118a82 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -1543,6 +1543,9 @@ init_optimization_passes (void) /* ??? We do want some kind of loop invariant motion, but we possibly need to adjust LIM to be more friendly towards preserving accurate debug information here. */ + /* Split critical edges before late uninit warning to reduce the + number of false positives from it. */ + NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_late_warn_uninitialized); NEXT_PASS (pass_uncprop); NEXT_PASS (pass_local_pure_const); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8e963bc99f7..097ca60b606 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-11 Richard Biener + + PR middle-end/58377 + * g++.dg/uninit-pred-4.C: New testcase. + 2013-09-11 Jakub Jelinek PR tree-optimization/58385 diff --git a/gcc/testsuite/g++.dg/uninit-pred-4.C b/gcc/testsuite/g++.dg/uninit-pred-4.C new file mode 100644 index 00000000000..94ab13c50d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/uninit-pred-4.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-Wuninitialized -Og" } */ + +int pop (); +int pop_first_bucket; + +int my_pop () +{ + int out; // { dg-bogus "uninitialized" "uninitialized variable warning" } + + while (pop_first_bucket) + if (pop_first_bucket && (out = pop())) + return out; + + return 0; +} -- cgit v1.2.3 From 02cec75dd4b658df3a2e524f89e44de5c9c536fd Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 11 Sep 2013 18:03:41 +0000 Subject: Improve __atomic_clear/test_and_set documentation Document that __atomic_clear and __atomic_test_and_set should only be used with bool. gcc/: 2013-09-11 Andi Kleen Backport from mainline * doc/extend.texi: Document that __atomic_clear and __atomic_test_and_set should only be used with bool. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202507 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/doc/extend.texi | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f346c0cbc99..c29f3c503ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-11 Andi Kleen + + Backport from mainline + * doc/extend.texi: Document that __atomic_clear and + __atomic_test_and_set should only be used with bool. + 2013-09-11 Richard Biener PR middle-end/58377 diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 9c8dd89ee58..dc6c31076cf 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7412,6 +7412,8 @@ This built-in function performs an atomic test-and-set operation on the byte at @code{*@var{ptr}}. The byte is set to some implementation defined nonzero ``set'' value and the return value is @code{true} if and only if the previous contents were ``set''. +It should be only used for operands of type @code{bool} or @code{char}. For +other types only part of the value may be set. All memory models are valid. @@ -7421,6 +7423,10 @@ All memory models are valid. This built-in function performs an atomic clear operation on @code{*@var{ptr}}. After the operation, @code{*@var{ptr}} contains 0. +It should be only used for operands of type @code{bool} or @code{char} and +in conjunction with @code{__atomic_test_and_set}. +For other types it may only clear partially. If the type is not @code{bool} +prefer using @code{__atomic_store}. The valid memory model variants are @code{__ATOMIC_RELAXED}, @code{__ATOMIC_SEQ_CST}, and -- cgit v1.2.3 From aab3442313b3956fcc5589223033ce48463f6c8e Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 11 Sep 2013 18:03:50 +0000 Subject: Fix HLE example in manual The HLE example in the manual only commits when using bool for the flag, because __atomic_clear only writes bool, and HLE requires the acquire and release to match. So when the example is copied with e.g. an int variable it does not commit and causes slower than expected performance. Some people are running into problems because of this. Switch it over to use __atomic_store. Also fix a minor typo nearby. gcc/: 2013-09-11 Andi Kleen Backport from mainline * doc/extend.texi: Dont use __atomic_clear in HLE example. Fix typo. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202508 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/doc/extend.texi | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c29f3c503ac..7d1353a0039 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-11 Andi Kleen + + Backport from mainline + * doc/extend.texi: Dont use __atomic_clear in HLE + example. Fix typo. + 2013-09-11 Andi Kleen Backport from mainline diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index dc6c31076cf..b2daa7657a9 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7498,18 +7498,20 @@ End lock elision on a lock variable. Memory model must be @code{__ATOMIC_RELEASE} or stronger. @end table -When a lock acquire fails it's required for good performance to abort +When a lock acquire fails it is required for good performance to abort the transaction quickly. This can be done with a @code{_mm_pause} @smallexample #include // For _mm_pause +int lockvar; + /* Acquire lock with lock elision */ while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE)) _mm_pause(); /* Abort failed transaction */ ... /* Free lock with lock elision */ -__atomic_clear(&lockvar, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); +__atomic_store(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); @end smallexample @node Object Size Checking -- cgit v1.2.3 From 144d1f0ae7d278d5fae675b7d7d02669019ff4b8 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 11 Sep 2013 18:04:00 +0000 Subject: Fix __atomic_store_n typo in recent manual change gcc/: 2013-09-11 Andi Kleen Backport from mainline * doc/extend.texi: Use __atomic_store_n instead of __atomic_store in HLE example. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202509 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/doc/extend.texi | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d1353a0039..e5fc1d0d327 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-11 Andi Kleen + + Backport from mainline + * doc/extend.texi: Use __atomic_store_n instead of + __atomic_store in HLE example. + 2013-09-11 Andi Kleen Backport from mainline diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index b2daa7657a9..eb7cdd4ff43 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7511,7 +7511,7 @@ while (__atomic_exchange_n(&lockvar, 1, __ATOMIC_ACQUIRE|__ATOMIC_HLE_ACQUIRE)) _mm_pause(); /* Abort failed transaction */ ... /* Free lock with lock elision */ -__atomic_store(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); +__atomic_store_n(&lockvar, 0, __ATOMIC_RELEASE|__ATOMIC_HLE_RELEASE); @end smallexample @node Object Size Checking -- cgit v1.2.3 From 69f3d9fd6fcbb994c7fa58778f087f13586243aa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 12 Sep 2013 00:16:55 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202513 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5782b96000b..48211128e09 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130911 +20130912 -- cgit v1.2.3 From 85361d763a1dad74006ab0163fcaf33aa9388d4e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 13 Sep 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202548 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 48211128e09..139d1d0cb32 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130912 +20130913 -- cgit v1.2.3 From ba1520d75c4a2fb0c52e84c88180a2d43440ae50 Mon Sep 17 00:00:00 2001 From: Christian Bruel Date: Fri, 13 Sep 2013 08:38:22 +0000 Subject: 2013-09-13 Christian Bruel PR target/58314 * config/sh/sh.md (mov_reg_reg): Allow memory reloads. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202559 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++ gcc/config/sh/sh.md | 20 +++-- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gcc.target/sh/torture/pr58314.c | 102 ++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/sh/torture/pr58314.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5fc1d0d327..63283a9a551 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-13 Christian Bruel + + PR target/58314 + * config/sh/sh.md (mov_reg_reg): Allow memory reloads. + 2013-09-11 Andi Kleen Backport from mainline diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 9a3836ffa84..8ae9cea761f 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -6834,10 +6834,11 @@ label: ;; If movqi_reg_reg is specified as an alternative of movqi, movqi will be ;; selected to copy QImode regs. If one of them happens to be allocated ;; on the stack, reload will stick to movqi insn and generate wrong -;; displacement addressing because of the generic m alternatives. -;; With the movqi_reg_reg being specified before movqi it will be initially -;; picked to load/store regs. If the regs regs are on the stack reload will -;; try other insns and not stick to movqi_reg_reg. +;; displacement addressing because of the generic m alternatives. +;; With the movqi_reg_reg being specified before movqi it will be initially +;; picked to load/store regs. If the regs regs are on the stack reload +;; try other insns and not stick to movqi_reg_reg, unless there were spilled +;; pseudos in which case 'm' constraints pertain. ;; The same applies to the movhi variants. ;; ;; Notice, that T bit is not allowed as a mov src operand here. This is to @@ -6849,11 +6850,14 @@ label: ;; reloading MAC subregs otherwise. For that probably special patterns ;; would be required. (define_insn "*mov_reg_reg" - [(set (match_operand:QIHI 0 "arith_reg_dest" "=r") - (match_operand:QIHI 1 "register_operand" "r"))] + [(set (match_operand:QIHI 0 "arith_reg_dest" "=r,m,*z") + (match_operand:QIHI 1 "register_operand" "r,*z,m"))] "TARGET_SH1 && !t_reg_operand (operands[1], VOIDmode)" - "mov %1,%0" - [(set_attr "type" "move")]) + "@ + mov %1,%0 + mov. %1,%0 + mov. %1,%0" + [(set_attr "type" "move,store,load")]) ;; FIXME: The non-SH2A and SH2A variants should be combined by adding ;; "enabled" attribute as it is done in other targets. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 097ca60b606..111a3c1aaf0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-13 Christian Bruel + + PR target/58314 + * gcc.target/sh/torture/pr58314.c: New test. + 2013-09-11 Richard Biener PR middle-end/58377 diff --git a/gcc/testsuite/gcc.target/sh/torture/pr58314.c b/gcc/testsuite/gcc.target/sh/torture/pr58314.c new file mode 100644 index 00000000000..61447d84ff9 --- /dev/null +++ b/gcc/testsuite/gcc.target/sh/torture/pr58314.c @@ -0,0 +1,102 @@ +/* { dg-do compile { target "sh*-*-*" } } */ +/* { dg-options "-Os" } */ + +typedef unsigned short __u16; +typedef unsigned int __u32; + +typedef signed short s16; + + +static inline __attribute__((always_inline)) __attribute__((__const__)) __u16 __arch_swab16(__u16 x) +{ + __asm__( + "swap.b %1, %0" + : "=r" (x) + : "r" (x)); + return x; +} + +void u16_add_cpu(__u16 *var) +{ + *var = __arch_swab16(*var); +} + +typedef struct xfs_mount { + int m_attr_magicpct; +} xfs_mount_t; + +typedef struct xfs_da_args { + struct xfs_mount *t_mountp; + int index; +} xfs_da_args_t; + +typedef struct xfs_dabuf { + void *data; +} xfs_dabuf_t; + +typedef struct xfs_attr_leaf_map { + __u16 base; + __u16 size; +} xfs_attr_leaf_map_t; +typedef struct xfs_attr_leaf_hdr { + __u16 count; + xfs_attr_leaf_map_t freemap[3]; +} xfs_attr_leaf_hdr_t; + +typedef struct xfs_attr_leaf_entry { + __u16 nameidx; +} xfs_attr_leaf_entry_t; + +typedef struct xfs_attr_leafblock { + xfs_attr_leaf_hdr_t hdr; + xfs_attr_leaf_entry_t entries[1]; +} xfs_attr_leafblock_t; + +int +xfs_attr_leaf_remove(xfs_attr_leafblock_t *leaf, xfs_da_args_t *args) +{ + xfs_attr_leaf_hdr_t *hdr; + xfs_attr_leaf_map_t *map; + xfs_attr_leaf_entry_t *entry; + int before, after, smallest, entsize; + int tablesize, tmp, i; + xfs_mount_t *mp; + hdr = &leaf->hdr; + mp = args->t_mountp; + + entry = &leaf->entries[args->index]; + + tablesize = __arch_swab16(hdr->count); + + map = &hdr->freemap[0]; + tmp = map->size; + before = after = -1; + smallest = 3 - 1; + entsize = xfs_attr_leaf_entsize(leaf, args->index); + + for (i = 0; i < 2; map++, i++) { + + if (map->base == tablesize) + u16_add_cpu(&map->base); + + if (__arch_swab16(map->base) + __arch_swab16(map->size) == __arch_swab16(entry->nameidx)) + before = i; + else if (map->base == entsize) + after = i; + else if (__arch_swab16(map->size) < tmp) + smallest = i; + } + + if (before >= 0) + { + map = &hdr->freemap[after]; + map->base = entry->nameidx; + + } + + map = &hdr->freemap[smallest]; + + map->base = __arch_swab16(entry->nameidx); + + return(tmp < mp->m_attr_magicpct); +} -- cgit v1.2.3 From a8b579c39cb37443934546a9b07e743274d253bb Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 13 Sep 2013 18:33:17 +0000 Subject: 2013-09-13 Paolo Carlini PR libstdc++/58415 * include/ext/sso_string_base.h (__sso_string_base<>:: __sso_string_base(__sso_string_base&&)): Fix thinkos about _M_length vs _M_set_length. * testsuite/ext/vstring/cons/58415-1.cc: New. * testsuite/ext/vstring/cons/58415-2.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202575 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++++ libstdc++-v3/include/ext/sso_string_base.h | 4 +-- libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc | 41 ++++++++++++++++++++++ libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc | 38 ++++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc create mode 100644 libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 04f1589936c..c049e7f8582 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2013-09-13 Paolo Carlini + + PR libstdc++/58415 + * include/ext/sso_string_base.h (__sso_string_base<>:: + __sso_string_base(__sso_string_base&&)): Fix thinkos about + _M_length vs _M_set_length. + * testsuite/ext/vstring/cons/58415-1.cc: New. + * testsuite/ext/vstring/cons/58415-2.cc: Likewise. + 2013-09-10 Kai Tietz Backport from trunk. diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h index 9e5b50e6e24..6cb4302b688 100644 --- a/libstdc++-v3/include/ext/sso_string_base.h +++ b/libstdc++-v3/include/ext/sso_string_base.h @@ -361,9 +361,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_capacity(__rcs._M_allocated_capacity); } - _M_length(__rcs._M_length()); - __rcs._M_length(0); + _M_set_length(__rcs._M_length()); __rcs._M_data(__rcs._M_local_data); + __rcs._M_set_length(0); } #endif diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc b/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc new file mode 100644 index 00000000000..cfcb8938e26 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++11" } +// { dg-require-string-conversions "" } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +typedef __gnu_cxx::__versa_string string; + +void test01() +{ + bool test __attribute__((unused)) = true; + + string s1("string"); + string s2(""); + std::swap(s1, s2); + + VERIFY( s1.c_str()[0] == '\0' ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc b/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc new file mode 100644 index 00000000000..9ba192ab228 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++11" } +// { dg-require-string-conversions "" } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +typedef __gnu_cxx::__versa_string string; + +void test01() +{ + string s1; + string s2 = std::move(s1); + + VERIFY( s2.c_str()[0] == '\0' ); +} + +int main() +{ + test01(); + return 0; +} -- cgit v1.2.3 From 068592847cb77bab114ddce28e1eca5f448d4a0d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 13 Sep 2013 22:22:31 +0000 Subject: PR c++/58273 * pt.c (any_type_dependent_elements_p): Actually check for type-dependence, not value-dependence. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202580 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/template/inherit9.C | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/inherit9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ed11a5d3e0c..173f082eee1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-09-13 Jason Merrill + + PR c++/58273 + * pt.c (any_type_dependent_elements_p): Actually check for + type-dependence, not value-dependence. + 2013-09-09 Jakub Jelinek PR c++/58325 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ed4a689b035..e3968ec420c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20127,7 +20127,7 @@ bool any_type_dependent_elements_p (const_tree list) { for (; list; list = TREE_CHAIN (list)) - if (value_dependent_expression_p (TREE_VALUE (list))) + if (type_dependent_expression_p (TREE_VALUE (list))) return true; return false; diff --git a/gcc/testsuite/g++.dg/template/inherit9.C b/gcc/testsuite/g++.dg/template/inherit9.C new file mode 100644 index 00000000000..926343b4e23 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/inherit9.C @@ -0,0 +1,15 @@ +// PR c++/58273 + +class A {}; +class B +{ + int goo(A); +}; +template +class D : public B +{ + void foo(A t) + { + int const i(B::goo(t)); + } +}; -- cgit v1.2.3 From 39520056fe9bfe18693c23659065f8cb896d3f08 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 14 Sep 2013 00:17:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202585 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 139d1d0cb32..9a1d2081c46 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130913 +20130914 -- cgit v1.2.3 From 758f5d03448da974336d29c0f8cad0cc2d92a6c9 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sat, 14 Sep 2013 17:00:32 +0000 Subject: PR target/58382 * config/pa/pa.c (pa_expand_prologue): Change mode in gen_rtx_POST_INC calls to word_mode. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202595 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/pa/pa.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63283a9a551..77c9943e925 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-14 John David Anglin + + PR target/58382 + * config/pa/pa.c (pa_expand_prologue): Change mode in gen_rtx_POST_INC + calls to word_mode. + 2013-09-13 Christian Bruel PR target/58314 diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index dc6f2e42bcf..abe663dfa02 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -4038,7 +4038,8 @@ pa_expand_prologue (void) || (! TARGET_64BIT && df_regs_ever_live_p (i + 1))) { rtx addr, insn, reg; - addr = gen_rtx_MEM (DFmode, gen_rtx_POST_INC (DFmode, tmpreg)); + addr = gen_rtx_MEM (DFmode, + gen_rtx_POST_INC (word_mode, tmpreg)); reg = gen_rtx_REG (DFmode, i); insn = emit_move_insn (addr, reg); if (DO_FRAME_NOTES) @@ -4331,7 +4332,8 @@ pa_expand_epilogue (void) if (df_regs_ever_live_p (i) || (! TARGET_64BIT && df_regs_ever_live_p (i + 1))) { - rtx src = gen_rtx_MEM (DFmode, gen_rtx_POST_INC (DFmode, tmpreg)); + rtx src = gen_rtx_MEM (DFmode, + gen_rtx_POST_INC (word_mode, tmpreg)); rtx dest = gen_rtx_REG (DFmode, i); emit_move_insn (dest, src); } -- cgit v1.2.3 From ecf305500f4b10c2300a809814250a66643c6765 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 15 Sep 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202598 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9a1d2081c46..57daadcc3d8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130914 +20130915 -- cgit v1.2.3 From a39f235fbc5c376ff16766f66b7d4d00338a8cf0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 16 Sep 2013 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202607 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 57daadcc3d8..ea8e2bcb3e4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130915 +20130916 -- cgit v1.2.3 From f1dead21b34c52ce4b4f968849a7a7fc290289c9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 17 Sep 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202640 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ea8e2bcb3e4..c2b0308a55b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130916 +20130917 -- cgit v1.2.3 From 5d0930148619f4082fe12e65568e8351b5b41d33 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Tue, 17 Sep 2013 13:59:42 +0000 Subject: [gcc/] 2013-09-17 Kyrylo Tkachov PR tree-optimization/58088 * fold-const.c (mask_with_trailing_zeros): New function. (fold_binary_loc): Make sure we don't recurse infinitely when the X in (X & C1) | C2 is a tree of the form (Y * K1) & K2. Use mask_with_trailing_zeros where appropriate. [gcc/testsuite/] 2013-09-17 Kyrylo Tkachov PR tree-optimization/58088 * gcc.c-torture/compile/pr58088.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202653 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++ gcc/fold-const.c | 62 +++++++++++++++++++-------- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.c-torture/compile/pr58088.c | 5 +++ 4 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr58088.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77c9943e925..ccfaea4fb33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-09-17 Kyrylo Tkachov + + PR tree-optimization/58088 + * fold-const.c (mask_with_trailing_zeros): New function. + (fold_binary_loc): Make sure we don't recurse infinitely + when the X in (X & C1) | C2 is a tree of the form (Y * K1) & K2. + Use mask_with_trailing_zeros where appropriate. + 2013-09-14 John David Anglin PR target/58382 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e2da77c07fc..3f59e307cbb 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9868,6 +9868,24 @@ exact_inverse (tree type, tree cst) } } +/* Mask out the tz least significant bits of X of type TYPE where + tz is the number of trailing zeroes in Y. */ +static double_int +mask_with_tz (tree type, double_int x, double_int y) +{ + int tz = y.trailing_zeros (); + + if (tz > 0) + { + double_int mask; + + mask = ~double_int::mask (tz); + mask = mask.ext (TYPE_PRECISION (type), TYPE_UNSIGNED (type)); + return mask & x; + } + return x; +} + /* Fold a binary expression of code CODE and type TYPE with operands OP0 and OP1. LOC is the location of the resulting expression. Return the folded expression if folding is successful. Otherwise, @@ -11192,6 +11210,8 @@ fold_binary_loc (location_t loc, { double_int c1, c2, c3, msk; int width = TYPE_PRECISION (type), w; + bool try_simplify = true; + c1 = tree_to_double_int (TREE_OPERAND (arg0, 1)); c2 = tree_to_double_int (arg1); @@ -11226,7 +11246,21 @@ fold_binary_loc (location_t loc, break; } } - if (c3 != c1) + + /* If X is a tree of the form (Y * K1) & K2, this might conflict + with that optimization from the BIT_AND_EXPR optimizations. + This could end up in an infinite recursion. */ + if (TREE_CODE (TREE_OPERAND (arg0, 0)) == MULT_EXPR + && TREE_CODE (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1)) + == INTEGER_CST) + { + tree t = TREE_OPERAND (TREE_OPERAND (arg0, 0), 1); + double_int masked = mask_with_tz (type, c3, tree_to_double_int (t)); + + try_simplify = (masked != c1); + } + + if (try_simplify && c3 != c1) return fold_build2_loc (loc, BIT_IOR_EXPR, type, fold_build2_loc (loc, BIT_AND_EXPR, type, TREE_OPERAND (arg0, 0), @@ -11616,22 +11650,16 @@ fold_binary_loc (location_t loc, && TREE_CODE (arg0) == MULT_EXPR && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) { - int arg1tz - = tree_to_double_int (TREE_OPERAND (arg0, 1)).trailing_zeros (); - if (arg1tz > 0) - { - double_int arg1mask, masked; - arg1mask = ~double_int::mask (arg1tz); - arg1mask = arg1mask.ext (TYPE_PRECISION (type), - TYPE_UNSIGNED (type)); - masked = arg1mask & tree_to_double_int (arg1); - if (masked.is_zero ()) - return omit_two_operands_loc (loc, type, build_zero_cst (type), - arg0, arg1); - else if (masked != tree_to_double_int (arg1)) - return fold_build2_loc (loc, code, type, op0, - double_int_to_tree (type, masked)); - } + double_int masked + = mask_with_tz (type, tree_to_double_int (arg1), + tree_to_double_int (TREE_OPERAND (arg0, 1))); + + if (masked.is_zero ()) + return omit_two_operands_loc (loc, type, build_zero_cst (type), + arg0, arg1); + else if (masked != tree_to_double_int (arg1)) + return fold_build2_loc (loc, code, type, op0, + double_int_to_tree (type, masked)); } /* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 111a3c1aaf0..623363b621f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-17 Kyrylo Tkachov + + PR tree-optimization/58088 + * gcc.c-torture/compile/pr58088.c: New test. + 2013-09-13 Christian Bruel PR target/58314 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58088.c b/gcc/testsuite/gcc.c-torture/compile/pr58088.c new file mode 100644 index 00000000000..07a9c68a7ff --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr58088.c @@ -0,0 +1,5 @@ +int +bar (int i) +{ + return 1 | ((i * 2) & 254); +} -- cgit v1.2.3 From 25f596ccea376a131979f88716e435b1581445ee Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 17 Sep 2013 22:11:57 +0000 Subject: reflect: Fix bug calling method on indirect value. The gccgo-specific iword function was checking v.kind, but for a method value that is always Func. Fix to check v.typ.Kind() instead. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202671 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/reflect/value.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 45a08587973..69a87031e56 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -611,7 +611,13 @@ func methodReceiver(op string, v Value, methodIndex int) (t *rtype, fn unsafe.Po } fn = unsafe.Pointer(&m.tfn) t = m.mtyp - rcvr = v.iword() + // Can't call iword here, because it checks v.kind, + // and that is always Func. + if v.flag&flagIndir != 0 && (v.typ.Kind() == Ptr || v.typ.Kind() == UnsafePointer) { + rcvr = loadIword(v.val, v.typ.size) + } else { + rcvr = iword(v.val) + } } return } -- cgit v1.2.3 From 808f06ee5ad9bfae12ac97eea6489879e14214e9 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 18 Sep 2013 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202674 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c2b0308a55b..ad7eb29a218 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130917 +20130918 -- cgit v1.2.3 From 6c1d2faae830993b9277661acd1fc06651d314da Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 18 Sep 2013 10:23:54 +0000 Subject: * gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of return variables for subprograms using the CICO mechanism. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/in_out_parameter4.adb | 30 +++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/in_out_parameter4.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index edecddf9118..aa9a9c3ea7d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-09-18 Eric Botcazou + + * gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of + return variables for subprograms using the CICO mechanism. + 2013-08-13 Eric Botcazou * gcc-interface/trans.c (can_equal_min_or_max_val_p): Be prepared for diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 256827dbe16..beb66139d39 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -3479,6 +3479,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) { tree gnu_retval; + gnu_return_var_stack->pop (); + add_stmt (gnu_result); add_stmt (build1 (LABEL_EXPR, void_type_node, gnu_return_label_stack->last ())); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 623363b621f..bb2d60a33e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-09-18 Eric Botcazou + + * gnat.dg/in_out_parameter4.adb: New test. + 2013-09-17 Kyrylo Tkachov PR tree-optimization/58088 diff --git a/gcc/testsuite/gnat.dg/in_out_parameter4.adb b/gcc/testsuite/gnat.dg/in_out_parameter4.adb new file mode 100644 index 00000000000..4f5cc218198 --- /dev/null +++ b/gcc/testsuite/gnat.dg/in_out_parameter4.adb @@ -0,0 +1,30 @@ +-- { dg-do run } +-- { dg-options "-gnat12 -gnatVa" } + +procedure In_Out_Parameter4 is + + type Enum is (E_Undetermined, E_Down, E_Up); + subtype Status_T is Enum range E_Down .. E_Up; + + function Recurse (Val : in out Integer) return Status_T is + + Result : Status_T; + + procedure Dummy (I : in out Integer) is begin null; end; + + begin + if Val > 500 then + Val := Val - 1; + Result := Recurse (Val); + return Result; + else + return E_UP; + end if; + end; + + Val : Integer := 501; + S : Status_T; + +begin + S := Recurse (Val); +end; -- cgit v1.2.3 From f376a1b93ba7861eea717afae76a02be44604828 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 18 Sep 2013 10:31:38 +0000 Subject: * gcc-interface/trans.c (gigi): Remove dead code. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202689 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/gcc-interface/trans.c | 12 ------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index aa9a9c3ea7d..e37f3518f1d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2013-09-18 Eric Botcazou + + * gcc-interface/trans.c (gigi): Remove dead code. + 2013-09-18 Eric Botcazou * gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index beb66139d39..20ef1ba6a24 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -286,9 +286,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, tree int64_type = gnat_type_for_size (64, 0); struct elab_info *info; int i; -#ifdef ORDINARY_MAP_INSTANCE - struct line_map *map; -#endif max_gnat_nodes = max_gnat_node; @@ -303,10 +300,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, type_annotate_only = (gigi_operating_mode == 1); - /* ??? Disable the generation of the SCO instance table until after the - back-end supports instance based debug info discriminators. */ - Generate_SCO_Instance_Table = False; - for (i = 0; i < number_file; i++) { /* Use the identifier table to make a permanent copy of the filename as @@ -326,11 +319,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED, /* We create the line map for a source file at once, with a fixed number of columns chosen to avoid jumping over the next power of 2. */ linemap_add (line_table, LC_ENTER, 0, filename, 1); -#ifdef ORDINARY_MAP_INSTANCE - map = LINEMAPS_ORDINARY_MAP_AT (line_table, i); - if (flag_debug_instances) - ORDINARY_MAP_INSTANCE (map) = file_info_ptr[i].Instance; -#endif linemap_line_start (line_table, file_info_ptr[i].Num_Source_Lines, 252); linemap_position_for_column (line_table, 252 - 1); linemap_add (line_table, LC_LEAVE, 0, NULL, 0); -- cgit v1.2.3 From c90dc963496affdb1a0a5f3c308e34e8ad02f30b Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 18 Sep 2013 10:55:36 +0000 Subject: PR ada/58264 * gcc-interface/trans.c (Attribute_to_gnu): Define GNAT_PREFIX local variable and use it throughout. : Note whether the prefix is the dereference of a pointer to unconstrained array and, in this case, capture the result for both Attr_First and Attr_Last. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202695 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 9 ++ gcc/ada/gcc-interface/trans.c | 140 +++++++++++++++++---------- gcc/testsuite/ChangeLog | 4 + gcc/testsuite/gnat.dg/array_bounds_test2.adb | 25 +++++ 4 files changed, 129 insertions(+), 49 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/array_bounds_test2.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e37f3518f1d..1926fb7f9ed 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2013-09-18 Eric Botcazou + + PR ada/58264 + * gcc-interface/trans.c (Attribute_to_gnu): Define GNAT_PREFIX local + variable and use it throughout. + : Note whether the prefix is the dereference of a pointer + to unconstrained array and, in this case, capture the result for both + Attr_First and Attr_Last. + 2013-09-18 Eric Botcazou * gcc-interface/trans.c (gigi): Remove dead code. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 20ef1ba6a24..779174a68b3 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1265,6 +1265,7 @@ Pragma_to_gnu (Node_Id gnat_node) static tree Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) { + const Node_Id gnat_prefix = Prefix (gnat_node); tree gnu_prefix, gnu_type, gnu_expr; tree gnu_result_type, gnu_result = error_mark_node; bool prefix_unused = false; @@ -1274,13 +1275,13 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) parameter types might be incomplete types coming from a limited with. */ if (Ekind (Etype (gnat_node)) == E_Access_Subprogram_Type && Is_Dispatch_Table_Entity (Etype (gnat_node)) - && Nkind (Prefix (gnat_node)) == N_Identifier - && Is_Subprogram (Entity (Prefix (gnat_node))) - && Is_Public (Entity (Prefix (gnat_node))) - && !present_gnu_tree (Entity (Prefix (gnat_node)))) - gnu_prefix = get_minimal_subprog_decl (Entity (Prefix (gnat_node))); + && Nkind (gnat_prefix) == N_Identifier + && Is_Subprogram (Entity (gnat_prefix)) + && Is_Public (Entity (gnat_prefix)) + && !present_gnu_tree (Entity (gnat_prefix))) + gnu_prefix = get_minimal_subprog_decl (Entity (gnat_prefix)); else - gnu_prefix = gnat_to_gnu (Prefix (gnat_node)); + gnu_prefix = gnat_to_gnu (gnat_prefix); gnu_type = TREE_TYPE (gnu_prefix); /* If the input is a NULL_EXPR, make a new one. */ @@ -1423,8 +1424,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) since it can use a special calling convention on some platforms, which cannot be propagated to the access type. */ else if (attribute == Attr_Access - && Nkind (Prefix (gnat_node)) == N_Identifier - && is_cplusplus_method (Entity (Prefix (gnat_node)))) + && Nkind (gnat_prefix) == N_Identifier + && is_cplusplus_method (Entity (gnat_prefix))) post_error ("access to C++ constructor or member function not allowed", gnat_node); @@ -1535,13 +1536,12 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) /* If this is a dereference and we have a special dynamic constrained subtype on the prefix, use it to compute the size; otherwise, use the designated subtype. */ - if (Nkind (Prefix (gnat_node)) == N_Explicit_Dereference) + if (Nkind (gnat_prefix) == N_Explicit_Dereference) { - Node_Id gnat_deref = Prefix (gnat_node); Node_Id gnat_actual_subtype - = Actual_Designated_Subtype (gnat_deref); + = Actual_Designated_Subtype (gnat_prefix); tree gnu_ptr_type - = TREE_TYPE (gnat_to_gnu (Prefix (gnat_deref))); + = TREE_TYPE (gnat_to_gnu (Prefix (gnat_prefix))); if (TYPE_IS_FAT_OR_THIN_POINTER_P (gnu_ptr_type) && Present (gnat_actual_subtype)) @@ -1602,7 +1602,6 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) align = DECL_ALIGN (TREE_OPERAND (gnu_prefix, 1)) / BITS_PER_UNIT; else { - Node_Id gnat_prefix = Prefix (gnat_node); Entity_Id gnat_type = Etype (gnat_prefix); unsigned int double_align; bool is_capped_double, align_clause; @@ -1674,28 +1673,38 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) : 1), i; struct parm_attr_d *pa = NULL; Entity_Id gnat_param = Empty; + bool unconstrained_ptr_deref = false; /* Make sure any implicit dereference gets done. */ gnu_prefix = maybe_implicit_deref (gnu_prefix); gnu_prefix = maybe_unconstrained_array (gnu_prefix); - /* We treat unconstrained array In parameters specially. */ - if (!Is_Constrained (Etype (Prefix (gnat_node)))) - { - Node_Id gnat_prefix = Prefix (gnat_node); - - /* This is the direct case. */ - if (Nkind (gnat_prefix) == N_Identifier - && Ekind (Entity (gnat_prefix)) == E_In_Parameter) - gnat_param = Entity (gnat_prefix); - - /* This is the indirect case. Note that we need to be sure that - the access value cannot be null as we'll hoist the load. */ - if (Nkind (gnat_prefix) == N_Explicit_Dereference - && Nkind (Prefix (gnat_prefix)) == N_Identifier - && Ekind (Entity (Prefix (gnat_prefix))) == E_In_Parameter - && Can_Never_Be_Null (Entity (Prefix (gnat_prefix)))) - gnat_param = Entity (Prefix (gnat_prefix)); + /* We treat unconstrained array In parameters specially. We also note + whether we are dereferencing a pointer to unconstrained array. */ + if (!Is_Constrained (Etype (gnat_prefix))) + switch (Nkind (gnat_prefix)) + { + case N_Identifier: + /* This is the direct case. */ + if (Ekind (Entity (gnat_prefix)) == E_In_Parameter) + gnat_param = Entity (gnat_prefix); + break; + + case N_Explicit_Dereference: + /* This is the indirect case. Note that we need to be sure that + the access value cannot be null as we'll hoist the load. */ + if (Nkind (Prefix (gnat_prefix)) == N_Identifier + && Ekind (Entity (Prefix (gnat_prefix))) == E_In_Parameter) + { + if (Can_Never_Be_Null (Entity (Prefix (gnat_prefix)))) + gnat_param = Entity (Prefix (gnat_prefix)); + } + else + unconstrained_ptr_deref = true; + break; + + default: + break; } /* If the prefix is the view conversion of a constrained array to an @@ -1830,22 +1839,54 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) { gnu_result = build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result); - if (attribute == Attr_First) - pa->first = gnu_result; - else if (attribute == Attr_Last) - pa->last = gnu_result; - else - pa->length = gnu_result; + switch (attribute) + { + case Attr_First: + pa->first = gnu_result; + break; + + case Attr_Last: + pa->last = gnu_result; + break; + + case Attr_Length: + case Attr_Range_Length: + pa->length = gnu_result; + break; + + default: + gcc_unreachable (); + } } - /* Set the source location onto the predicate of the condition in the - 'Length case but do not do it if the expression is cached to avoid - messing up the debug info. */ - else if ((attribute == Attr_Range_Length || attribute == Attr_Length) - && TREE_CODE (gnu_result) == COND_EXPR - && EXPR_P (TREE_OPERAND (gnu_result, 0))) - set_expr_location_from_node (TREE_OPERAND (gnu_result, 0), - gnat_node); + /* Otherwise, evaluate it each time it is referenced. */ + else + switch (attribute) + { + case Attr_First: + case Attr_Last: + /* If we are dereferencing a pointer to unconstrained array, we + need to capture the value because the pointed-to bounds may + subsequently be released. */ + if (unconstrained_ptr_deref) + gnu_result + = build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result); + break; + + case Attr_Length: + case Attr_Range_Length: + /* Set the source location onto the predicate of the condition + but not if the expression is cached to avoid messing up the + debug info. */ + if (TREE_CODE (gnu_result) == COND_EXPR + && EXPR_P (TREE_OPERAND (gnu_result, 0))) + set_expr_location_from_node (TREE_OPERAND (gnu_result, 0), + gnat_node); + break; + + default: + gcc_unreachable (); + } break; } @@ -2018,8 +2059,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) case Attr_Mechanism_Code: { + Entity_Id gnat_obj = Entity (gnat_prefix); int code; - Entity_Id gnat_obj = Entity (Prefix (gnat_node)); prefix_unused = true; gnu_result_type = get_unpadded_type (Etype (gnat_node)); @@ -2054,10 +2095,11 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) it has a side-effect. But don't do it if the prefix is just an entity name. However, if an access check is needed, we must do it. See second example in AARM 11.6(5.e). */ - if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix) - && !Is_Entity_Name (Prefix (gnat_node))) - gnu_result = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix, - gnu_result); + if (prefix_unused + && TREE_SIDE_EFFECTS (gnu_prefix) + && !Is_Entity_Name (gnat_prefix)) + gnu_result + = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix, gnu_result); *gnu_result_type_p = gnu_result_type; return gnu_result; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb2d60a33e9..712b4d1e3f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-09-18 Eric Botcazou + + * gnat.dg/array_bounds_test2.adb: New test. + 2013-09-18 Eric Botcazou * gnat.dg/in_out_parameter4.adb: New test. diff --git a/gcc/testsuite/gnat.dg/array_bounds_test2.adb b/gcc/testsuite/gnat.dg/array_bounds_test2.adb new file mode 100644 index 00000000000..43e1ed3ced0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array_bounds_test2.adb @@ -0,0 +1,25 @@ +-- { dg-do run } + +with Ada.Unchecked_Deallocation; + +procedure Array_Bounds_Test2 is + + type String_Ptr_T is access String; + procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr_T); + String_Data : String_Ptr_T := new String'("Hello World"); + + function Peek return String_Ptr_T is + begin + return String_Data; + end Peek; + +begin + declare + Corrupted_String : String := Peek.all; + begin + Free(String_Data); + if Corrupted_String'First /= 1 then + raise Program_Error; + end if; + end; +end; -- cgit v1.2.3 From 58fd5fc7587290478df6f8a4cf4dee47540694d8 Mon Sep 17 00:00:00 2001 From: Daniel Morris Date: Wed, 18 Sep 2013 11:07:16 +0000 Subject: 2013-09-18 Daniel Morris Paolo Carlini PR c++/58458 * doc/implement-cxx.texi: Fix references to the C++ standards. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202697 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/doc/implement-cxx.texi | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ccfaea4fb33..40bef77dca4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-18 Daniel Morris + Paolo Carlini + + PR c++/58458 + * doc/implement-cxx.texi: Fix references to the C++ standards. + 2013-09-17 Kyrylo Tkachov PR tree-optimization/58088 diff --git a/gcc/doc/implement-cxx.texi b/gcc/doc/implement-cxx.texi index e9236cab6f4..43a8a597ab6 100644 --- a/gcc/doc/implement-cxx.texi +++ b/gcc/doc/implement-cxx.texi @@ -9,8 +9,8 @@ A conforming implementation of ISO C++ is required to document its choice of behavior in each of the areas that are designated ``implementation defined''. The following lists all such areas, -along with the section numbers from the ISO/IEC 14822:1998 and ISO/IEC -14822:2003 standards. Some areas are only implementation-defined in +along with the section numbers from the ISO/IEC 14882:1998 and ISO/IEC +14882:2003 standards. Some areas are only implementation-defined in one version of the standard. Some choices depend on the externally determined ABI for the platform -- cgit v1.2.3 From 4db1f4ba15a4fa86841a2b038e07062a44f284b4 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Wed, 18 Sep 2013 16:37:35 +0000 Subject: * arm.c (arm_expand_prologue): Validate architecture supports LDRD/STRD before accepting tuning preferences. (arm_expand_epilogue): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202709 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++-- gcc/config/arm/arm.c | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 40bef77dca4..1c465e9f786 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-18 Richard Earnshaw + + * arm.c (arm_expand_prologue): Validate architecture supports + LDRD/STRD before accepting tuning preferences. + (arm_expand_epilogue): Likewise. + 2013-09-18 Daniel Morris Paolo Carlini @@ -20,8 +26,8 @@ 2013-09-13 Christian Bruel - PR target/58314 - * config/sh/sh.md (mov_reg_reg): Allow memory reloads. + PR target/58314 + * config/sh/sh.md (mov_reg_reg): Allow memory reloads. 2013-09-11 Andi Kleen diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index ef92f880ecd..d787a6e80c2 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -17475,7 +17475,8 @@ arm_expand_prologue (void) } } - if (current_tune->prefer_ldrd_strd + if (TARGET_LDRD + && current_tune->prefer_ldrd_strd && !optimize_function_for_size_p (cfun)) { if (TARGET_THUMB2) @@ -23789,7 +23790,8 @@ arm_expand_epilogue (bool really_return) } else { - if (current_tune->prefer_ldrd_strd + if (TARGET_LDRD + && current_tune->prefer_ldrd_strd && !optimize_function_for_size_p (cfun)) { if (TARGET_THUMB2) -- cgit v1.2.3 From 1d0a48810dd02432ec3ea2c02594e6100902d567 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 18 Sep 2013 18:13:15 +0000 Subject: /cp 2013-09-18 Paolo Carlini PR c++/58457 * class.c (instantiate_type): Loosen a bit the gcc_assert. /testsuite 2013-09-18 Paolo Carlini PR c++/58457 * g++.dg/parse/using4.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202712 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/parse/using4.C | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/using4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 173f082eee1..377376f4add 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-09-18 Paolo Carlini + + PR c++/58457 + * class.c (instantiate_type): Loosen a bit the gcc_assert. + 2013-09-13 Jason Merrill PR c++/58273 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ea321b82fe5..578c92bc634 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7508,7 +7508,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) dependent on overload resolution. */ gcc_assert (TREE_CODE (rhs) == ADDR_EXPR || TREE_CODE (rhs) == COMPONENT_REF - || really_overloaded_fn (rhs) + || is_overloaded_fn (rhs) || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL)); /* This should really only be used when attempting to distinguish diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 712b4d1e3f9..aee63870607 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ +2013-09-18 Paolo Carlini + + PR c++/58457 + * g++.dg/parse/using4.C: New. + 2013-09-18 Eric Botcazou - * gnat.dg/array_bounds_test2.adb: New test. + * gnat.dg/array_bounds_test2.adb: New test. 2013-09-18 Eric Botcazou diff --git a/gcc/testsuite/g++.dg/parse/using4.C b/gcc/testsuite/g++.dg/parse/using4.C new file mode 100644 index 00000000000..2abe399f8dc --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/using4.C @@ -0,0 +1,20 @@ +// PR c++/58457 + +struct allocator +{ + void operator delete (void*); + void* operator new (__SIZE_TYPE__, void*); +}; + +struct type : public allocator +{ + type() {} + using allocator::operator new; + using allocator::operator delete; +}; + +int main() +{ + new (0) type; + return 0; +} -- cgit v1.2.3 From 30c9cb6287d66a25d885dfbc6a8491e494ff489c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 18 Sep 2013 18:36:33 +0000 Subject: compiler: Fix type of result of shortcut calculation. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202718 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index be8ec5939f3..17cbb6b9b49 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -2367,7 +2367,7 @@ Shortcuts::convert_shortcut(Block* enclosing, Expression** pshortcut) Block* retblock = new Block(enclosing, loc); retblock->set_end_location(loc); - Temporary_statement* ts = Statement::make_temporary(Type::lookup_bool_type(), + Temporary_statement* ts = Statement::make_temporary(shortcut->type(), left, loc); retblock->add_statement(ts); -- cgit v1.2.3 From c48ab2bb6a1d8378b5ed49b14539dc684cbdfc46 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 18 Sep 2013 21:54:08 +0000 Subject: compiler: Correctly handle identical unnamed structs with methods. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202724 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/types.cc | 24 ++++++++++++++++++++++-- gcc/go/gofrontend/types.h | 20 +++++++++++--------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 9ce329d5503..0e8f479db70 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -4229,6 +4229,11 @@ Struct_field::is_embedded_builtin(Gogo* gogo) const Struct_type::Identical_structs Struct_type::identical_structs; +// A hash table used to merge method sets for identical unnamed +// structs. + +Struct_type::Struct_method_tables Struct_type::struct_method_tables; + // Traversal. int @@ -4693,9 +4698,24 @@ Struct_type::interface_method_table(Gogo* gogo, const Interface_type* interface, bool is_pointer) { + std::pair + val(this, NULL); + std::pair ins = + Struct_type::struct_method_tables.insert(val); + + Struct_method_table_pair* smtp; + if (!ins.second) + smtp = ins.first->second; + else + { + smtp = new Struct_method_table_pair(); + smtp->first = NULL; + smtp->second = NULL; + ins.first->second = smtp; + } + return Type::interface_method_table(gogo, this, interface, is_pointer, - &this->interface_method_tables_, - &this->pointer_interface_method_tables_); + &smtp->first, &smtp->second); } // Convert struct fields to the backend representation. This is not diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index d207fe5a375..d8a3080f586 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -2041,8 +2041,7 @@ class Struct_type : public Type public: Struct_type(Struct_field_list* fields, Location location) : Type(TYPE_STRUCT), - fields_(fields), location_(location), all_methods_(NULL), - interface_method_tables_(NULL), pointer_interface_method_tables_(NULL) + fields_(fields), location_(location), all_methods_(NULL) { } // Return the field NAME. This only looks at local fields, not at @@ -2200,6 +2199,16 @@ class Struct_type : public Type static Identical_structs identical_structs; + // Used to manage method tables for identical unnamed structs. + typedef std::pair + Struct_method_table_pair; + + typedef Unordered_map_hash(Struct_type*, Struct_method_table_pair*, + Type_hash_identical, Type_identical) + Struct_method_tables; + + static Struct_method_tables struct_method_tables; + // Used to avoid infinite loops in field_reference_depth. struct Saw_named_type { @@ -2218,13 +2227,6 @@ class Struct_type : public Type Location location_; // If this struct is unnamed, a list of methods. Methods* all_methods_; - // A mapping from interfaces to the associated interface method - // tables for this type. Only used if this struct is unnamed. - Interface_method_tables* interface_method_tables_; - // A mapping from interfaces to the associated interface method - // tables for pointers to this type. Only used if this struct is - // unnamed. - Interface_method_tables* pointer_interface_method_tables_; }; // The type of an array. -- cgit v1.2.3 From e5cdad4cdacbad42d914bb8da8d6e3da2209a40c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 18 Sep 2013 23:28:10 +0000 Subject: compiler: Fix name of unexported method of embedded imported type. Test case is fixedbugs/bug478.go in master testsuite. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202727 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo-tree.cc | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 69797f93342..7813cc18822 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -1009,6 +1009,16 @@ Named_object::get_id(Gogo* gogo) else package_name = this->package_->package_name(); + // Note that this will be misleading if this is an unexported + // method generated for an embedded imported type. In that case + // the unexported method should have the package name of the + // package from which it is imported, but we are going to give + // it our package name. Fixing this would require knowing the + // package name, but we only know the package path. It might be + // better to use package paths here anyhow. This doesn't affect + // the assembler code, because we always set that name in + // Function::get_or_make_decl anyhow. FIXME. + decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); Function_type* fntype; @@ -1317,7 +1327,21 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) || this->type_->is_method()) { TREE_PUBLIC(decl) = 1; - std::string asm_name = gogo->pkgpath_symbol(); + std::string pkgpath = gogo->pkgpath_symbol(); + if (this->type_->is_method() + && Gogo::is_hidden_name(no->name()) + && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) + { + // This is a method we created for an unexported + // method of an imported embedded type. We need to + // use the pkgpath of the imported package to avoid + // a possible name collision. See bug478 for a test + // case. + pkgpath = Gogo::hidden_name_pkgpath(no->name()); + pkgpath = Gogo::pkgpath_for_symbol(pkgpath); + } + + std::string asm_name = pkgpath; asm_name.append(1, '.'); asm_name.append(Gogo::unpack_hidden_name(no->name())); if (this->type_->is_method()) -- cgit v1.2.3 From b1040216da1f060e642e4947386192bb51eb0835 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 19 Sep 2013 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202730 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ad7eb29a218..1ec331eab57 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130918 +20130919 -- cgit v1.2.3 From 4ebc16c6fddbb11e21528ff91330312cf95ab622 Mon Sep 17 00:00:00 2001 From: Mitsuru Kariya Date: Thu, 19 Sep 2013 10:19:58 +0000 Subject: 2013-09-19 Mitsuru Kariya Chris Jefferson PR libstdc++/58358 * include/bits/stl_algo.h (search_n): Fix to guarantee a number of comparisons <= number of elements in the range. * testsuite/25_algorithms/search_n/58358.cc: New. * testsuite/25_algorithms/search_n/iterator.cc: Extend. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202736 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 +++ libstdc++-v3/include/bits/stl_algo.h | 74 +++++++--------------- .../testsuite/25_algorithms/search_n/58358.cc | 41 ++++++++++++ .../testsuite/25_algorithms/search_n/iterator.cc | 8 +++ 4 files changed, 80 insertions(+), 52 deletions(-) create mode 100644 libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c049e7f8582..0cf38cab9f8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2013-09-19 Mitsuru Kariya + Chris Jefferson + + PR libstdc++/58358 + * include/bits/stl_algo.h (search_n): Fix to guarantee a number + of comparisons <= number of elements in the range. + * testsuite/25_algorithms/search_n/58358.cc: New. + * testsuite/25_algorithms/search_n/iterator.cc: Extend. + 2013-09-13 Paolo Carlini PR libstdc++/58415 diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 873005b8b1a..631be020696 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -385,38 +385,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _DistanceType; _DistanceType __tailSize = __last - __first; - const _DistanceType __pattSize = __count; + _DistanceType __remainder = __count; - if (__tailSize < __pattSize) - return __last; - - const _DistanceType __skipOffset = __pattSize - 1; - _RandomAccessIter __lookAhead = __first + __skipOffset; - __tailSize -= __pattSize; - - while (1) // the main loop... + while (__remainder <= __tailSize) // the main loop... { - // __lookAhead here is always pointing to the last element of next - // possible match. - while (!(*__lookAhead == __val)) // the skip loop... - { - if (__tailSize < __pattSize) - return __last; // Failure - __lookAhead += __pattSize; - __tailSize -= __pattSize; - } - _DistanceType __remainder = __skipOffset; - for (_RandomAccessIter __backTrack = __lookAhead - 1; - *__backTrack == __val; --__backTrack) + __first += __remainder; + __tailSize -= __remainder; + // __first here is always pointing to one past the last element of + // next possible match. + _RandomAccessIter __backTrack = __first; + while (*--__backTrack == __val) { if (--__remainder == 0) - return (__lookAhead - __skipOffset); // Success + return (__first - __count); // Success } - if (__remainder > __tailSize) - return __last; // Failure - __lookAhead += __remainder; - __tailSize -= __remainder; + __remainder = __count + 1 - (__first - __backTrack); } + return __last; // Failure } // search_n @@ -478,38 +463,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _DistanceType; _DistanceType __tailSize = __last - __first; - const _DistanceType __pattSize = __count; + _DistanceType __remainder = __count; - if (__tailSize < __pattSize) - return __last; - - const _DistanceType __skipOffset = __pattSize - 1; - _RandomAccessIter __lookAhead = __first + __skipOffset; - __tailSize -= __pattSize; - - while (1) // the main loop... + while (__remainder <= __tailSize) // the main loop... { - // __lookAhead here is always pointing to the last element of next - // possible match. - while (!bool(__binary_pred(*__lookAhead, __val))) // the skip loop... - { - if (__tailSize < __pattSize) - return __last; // Failure - __lookAhead += __pattSize; - __tailSize -= __pattSize; - } - _DistanceType __remainder = __skipOffset; - for (_RandomAccessIter __backTrack = __lookAhead - 1; - __binary_pred(*__backTrack, __val); --__backTrack) + __first += __remainder; + __tailSize -= __remainder; + // __first here is always pointing to one past the last element of + // next possible match. + _RandomAccessIter __backTrack = __first; + while (__binary_pred(*--__backTrack, __val)) { if (--__remainder == 0) - return (__lookAhead - __skipOffset); // Success + return (__first - __count); // Success } - if (__remainder > __tailSize) - return __last; // Failure - __lookAhead += __remainder; - __tailSize -= __remainder; + __remainder = __count + 1 - (__first - __backTrack); } + return __last; // Failure } // find_end for forward iterators. diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc new file mode 100644 index 00000000000..b5ae34617f9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc @@ -0,0 +1,41 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// { dg-options "-std=gnu++11" } + +// 25.1.9 [lib.alg.search] + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector a{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + int count = 0; + std::search_n(a.begin(), a.end(), 10, 1, + [&count](int t, int u) { ++count; return t == u; }); + VERIFY( count <= 11 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc index 27cffe74116..10616960dc2 100644 --- a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc @@ -31,9 +31,11 @@ int array1[11] = {0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0}; int array2[TEST_DEPTH]; +int pred_count; bool pred(int i, int j) { + ++pred_count; return i == j; } @@ -90,16 +92,22 @@ int main() int* t1 = search_n(forwardcon.begin(), forwardcon.end(), j, 1).ptr; + pred_count = 0; int* t2 = search_n(forwardcon.begin(), forwardcon.end(), j, 1, pred).ptr; + VERIFY(pred_count <= i); int* t3 = search_n(bidircon.begin(), bidircon.end(), j, 1).ptr; + pred_count = 0; int* t4 = search_n(bidircon.begin(), bidircon.end(), j, 1, pred).ptr; + VERIFY(pred_count <= i); int* t5 = search_n(randomcon.begin(), randomcon.end(), j, 1).ptr; + pred_count = 0; int* t6 = search_n(randomcon.begin(), randomcon.end(), j, 1, pred).ptr; + VERIFY(pred_count <= i); VERIFY((t1 == t2) && (t2 == t3) && (t3 == t4) && (t4 == t5) && (t5 == t6)); } -- cgit v1.2.3 From 5ab1e3d5936764ffd880ec9f11538b525c999098 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 19 Sep 2013 11:54:23 +0000 Subject: * omp-low.c (expand_omp_sections): Always pass len - 1 to GOMP_sections_start, even if !exit_reachable. libgomp/ * testsuite/libgomp.c/sections-2.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202739 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/omp-low.c | 3 +-- libgomp/ChangeLog | 4 ++++ libgomp/testsuite/libgomp.c/sections-2.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 libgomp/testsuite/libgomp.c/sections-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c465e9f786..58f13c7bc90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-19 Jakub Jelinek + + * omp-low.c (expand_omp_sections): Always pass len - 1 to + GOMP_sections_start, even if !exit_reachable. + 2013-09-18 Richard Earnshaw * arm.c (arm_expand_prologue): Validate architecture supports diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 354d30ad0a2..95d1168617b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -5010,8 +5010,7 @@ expand_omp_sections (struct omp_region *region) { /* If we are not inside a combined parallel+sections region, call GOMP_sections_start. */ - t = build_int_cst (unsigned_type_node, - exit_reachable ? len - 1 : len); + t = build_int_cst (unsigned_type_node, len - 1); u = builtin_decl_explicit (BUILT_IN_GOMP_SECTIONS_START); stmt = gimple_build_call (u, 1, t); } diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 84f8cdf1076..af7a37a2b90 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2013-09-19 Jakub Jelinek + + * testsuite/libgomp.c/sections-2.c: New test. + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/libgomp/testsuite/libgomp.c/sections-2.c b/libgomp/testsuite/libgomp.c/sections-2.c new file mode 100644 index 00000000000..38216befe0b --- /dev/null +++ b/libgomp/testsuite/libgomp.c/sections-2.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ + +#include +#include + +__attribute__((noinline, noclone, noreturn)) +void +foo () +{ + sleep (4); + exit (0); +} + +int +main () +{ + #pragma omp parallel + { + #pragma omp sections + { + foo (); + #pragma omp section + foo (); + #pragma omp section + foo (); + } + } + return 0; +} -- cgit v1.2.3 From fdef0d1e9120195e747913d4bcbf02604b84a330 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 19 Sep 2013 17:33:32 +0000 Subject: compiler: Fix inconsistent check for structs using memcmp for ==. Test is bug479. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202752 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 2 -- gcc/go/gofrontend/types.cc | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 0b010334229..99edb4b8031 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -7752,8 +7752,6 @@ Builtin_call_expression::do_numeric_constant_value(Numeric_constant* nc) const return false; if (arg_type->is_abstract()) return false; - if (arg_type->named_type() != NULL) - arg_type->named_type()->convert(this->gogo_); unsigned int ret; if (this->code_ == BUILTIN_SIZEOF) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 0e8f479db70..32f827dd316 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -2288,9 +2288,7 @@ Type::is_backend_type_size_known(Gogo* gogo) } case TYPE_NAMED: - // Begin converting this type to the backend representation. - // This will create a placeholder if necessary. - this->get_backend(gogo); + this->named_type()->convert(gogo); return this->named_type()->is_named_backend_type_size_known(); case TYPE_FORWARD: -- cgit v1.2.3 From d0b2060c877a0f356f6d54bbfdc224ebb7c491df Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 Sep 2013 00:16:46 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202762 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1ec331eab57..0f54f2b0175 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130919 +20130920 -- cgit v1.2.3 From 624ad7dd73c1ba7ff83048419bd4b7e3089cad2e Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Fri, 20 Sep 2013 22:30:21 +0000 Subject: * config/pa/pa.md: In "scc" insn patterns, change output template to handle const0_rtx in reg_or_0_operand operands. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202799 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/pa/pa.md | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58f13c7bc90..4bd65cb38c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-20 John David Anglin + + * config/pa/pa.md: In "scc" insn patterns, change output template to + handle const0_rtx in reg_or_0_operand operands. + 2013-09-19 Jakub Jelinek * omp-low.c (expand_omp_sections): Always pass len - 1 to diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index bcafc5c5329..af24886cd59 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -836,7 +836,7 @@ [(match_operand:SI 1 "reg_or_0_operand" "rM") (match_operand:SI 2 "arith11_operand" "rI")]))] "" - "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0" + "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi 1,%0" [(set_attr "type" "binary") (set_attr "length" "8")]) @@ -846,7 +846,7 @@ [(match_operand:DI 1 "reg_or_0_operand" "rM") (match_operand:DI 2 "arith11_operand" "rI")]))] "TARGET_64BIT" - "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0" + "cmp%I2clr,*%B3 %2,%r1,%0\;ldi 1,%0" [(set_attr "type" "binary") (set_attr "length" "8")]) @@ -859,7 +859,7 @@ [(match_operand:SI 4 "reg_or_0_operand" "rM") (match_operand:SI 5 "arith11_operand" "rI")])))] "" - "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0" + "{com%I2clr|cmp%I2clr},%S3 %2,%r1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%r4,%0\;ldi 1,%0" [(set_attr "type" "binary") (set_attr "length" "12")]) @@ -872,7 +872,7 @@ [(match_operand:DI 4 "reg_or_0_operand" "rM") (match_operand:DI 5 "arith11_operand" "rI")])))] "TARGET_64BIT" - "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0" + "cmp%I2clr,*%S3 %2,%r1,%%r0\;cmp%I5clr,*%B6 %5,%r4,%0\;ldi 1,%0" [(set_attr "type" "binary") (set_attr "length" "12")]) @@ -884,7 +884,7 @@ [(match_operand:SI 1 "reg_or_0_operand" "rM") (match_operand:SI 2 "arith11_operand" "rI")])))] "" - "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0" + "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi -1,%0" [(set_attr "type" "binary") (set_attr "length" "8")]) @@ -894,7 +894,7 @@ [(match_operand:DI 1 "reg_or_0_operand" "rM") (match_operand:DI 2 "arith11_operand" "rI")])))] "TARGET_64BIT" - "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0" + "cmp%I2clr,*%B3 %2,%r1,%0\;ldi -1,%0" [(set_attr "type" "binary") (set_attr "length" "8")]) -- cgit v1.2.3 From 2e8d119f5d80ccaa622fb60aa9a082df3cfff5c0 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Sat, 21 Sep 2013 00:00:38 +0000 Subject: PR middle-end/56791 * config/pa/pa.c (pa_option_override): Disable auto increment and decrement instructions until reload is completed. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202808 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/pa/pa.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bd65cb38c1..ec438288266 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2013-09-20 John David Anglin + PR middle-end/56791 + * config/pa/pa.c (pa_option_override): Disable auto increment and + decrement instructions until reload is completed. + * config/pa/pa.md: In "scc" insn patterns, change output template to handle const0_rtx in reg_or_0_operand operands. diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index abe663dfa02..87ef8fbbcb7 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -513,6 +513,12 @@ pa_option_override (void) write_symbols = NO_DEBUG; } +#ifdef AUTO_INC_DEC + /* FIXME: Disable auto increment and decrement processing until reload + is completed. See PR middle-end 56791. */ + flag_auto_inc_dec = reload_completed; +#endif + /* We only support the "big PIC" model now. And we always generate PIC code when in 64bit mode. */ if (flag_pic == 1 || TARGET_64BIT) -- cgit v1.2.3 From 5c06ef06130a9515781d54e642861b000f17d7c6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 Sep 2013 00:16:40 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202810 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 0f54f2b0175..b7c52558490 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130920 +20130921 -- cgit v1.2.3 From 6851e0a1bc39e1f26384d692de3e9e46740663e6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 Sep 2013 00:16:41 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202816 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b7c52558490..05b35bf45cb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130921 +20130922 -- cgit v1.2.3 From 87c84e1f0941c2504c36154081e7a7c6ab54e7ff Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 23 Sep 2013 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202821 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 05b35bf45cb..2b53475b21d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130922 +20130923 -- cgit v1.2.3 From 721bd89d5f4e0945e12aa9a37ce90bf1f172cdbe Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 23 Sep 2013 14:19:31 +0000 Subject: * config/rs6000/predicates.md (add_cint_operand): New. (reg_or_add_cint_operand, small_toc_ref): Use add_cint_operand. * config/rs6000/rs6000.md (largetoc_high_plus): Restrict offset using add_cint_operand. (largetoc_high_plus_aix): Likewise. * config/rs6000/rs6000.c (toc_relative_expr_p): Use add_cint_operand. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202828 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/rs6000/predicates.md | 14 +++++++++----- gcc/config/rs6000/rs6000.c | 2 +- gcc/config/rs6000/rs6000.md | 4 ++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec438288266..c9597892ccc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-09-23 Alan Modra + + * config/rs6000/predicates.md (add_cint_operand): New. + (reg_or_add_cint_operand, small_toc_ref): Use add_cint_operand. + * config/rs6000/rs6000.md (largetoc_high_plus): Restrict offset + using add_cint_operand. + (largetoc_high_plus_aix): Likewise. + * config/rs6000/rs6000.c (toc_relative_expr_p): Use add_cint_operand. + 2013-09-20 John David Anglin PR middle-end/56791 diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index baca8789666..07944db1089 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -275,14 +275,18 @@ (ior (match_code "const_int") (match_operand 0 "gpc_reg_operand"))) +;; Return 1 if op is a constant integer valid for addition with addis, addi. +(define_predicate "add_cint_operand" + (and (match_code "const_int") + (match_test "(unsigned HOST_WIDE_INT) + (INTVAL (op) + (mode == SImode ? 0x80000000 : 0x80008000)) + < (unsigned HOST_WIDE_INT) 0x100000000ll"))) + ;; Return 1 if op is a constant integer valid for addition ;; or non-special register. (define_predicate "reg_or_add_cint_operand" (if_then_else (match_code "const_int") - (match_test "(HOST_BITS_PER_WIDE_INT == 32 - && (mode == SImode || INTVAL (op) < 0x7fff8000)) - || ((unsigned HOST_WIDE_INT) (INTVAL (op) + 0x80008000) - < (unsigned HOST_WIDE_INT) 0x100000000ll)") + (match_operand 0 "add_cint_operand") (match_operand 0 "gpc_reg_operand"))) ;; Return 1 if op is a constant integer valid for subtraction @@ -1525,7 +1529,7 @@ (define_predicate "small_toc_ref" (match_code "unspec,plus") { - if (GET_CODE (op) == PLUS && CONST_INT_P (XEXP (op, 1))) + if (GET_CODE (op) == PLUS && add_cint_operand (XEXP (op, 1), mode)) op = XEXP (op, 0); return GET_CODE (op) == UNSPEC && XINT (op, 1) == UNSPEC_TOCREL; diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e22c33dc37e..f8579fd984b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5335,7 +5335,7 @@ toc_relative_expr_p (const_rtx op, bool strict) tocrel_base = op; tocrel_offset = const0_rtx; - if (GET_CODE (op) == PLUS && CONST_INT_P (XEXP (op, 1))) + if (GET_CODE (op) == PLUS && add_cint_operand (XEXP (op, 1), GET_MODE (op))) { tocrel_base = XEXP (op, 0); tocrel_offset = XEXP (op, 1); diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index d37a6ed6759..94481232811 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10462,7 +10462,7 @@ (unspec [(match_operand:DI 1 "" "") (match_operand:DI 2 "gpc_reg_operand" "b")] UNSPEC_TOCREL) - (match_operand 3 "const_int_operand" "n"))))] + (match_operand:DI 3 "add_cint_operand" "n"))))] "TARGET_ELF && TARGET_CMODEL != CMODEL_SMALL" "addis %0,%2,%1+%3@toc@ha") @@ -10473,7 +10473,7 @@ (unspec [(match_operand:P 1 "" "") (match_operand:P 2 "gpc_reg_operand" "b")] UNSPEC_TOCREL) - (match_operand 3 "const_int_operand" "n"))))] + (match_operand:P 3 "add_cint_operand" "n"))))] "TARGET_XCOFF && TARGET_CMODEL != CMODEL_SMALL" "addis %0,%1+%3@u(%2)") -- cgit v1.2.3 From d75b3f04a5a3090d5658fcafb5c332b629bdba93 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 23 Sep 2013 14:27:06 +0000 Subject: PR target/58330 * config/rs6000/rs6000.md (bswapdi2_64bit): Disable for volatile mems. gcc/testsuite/ * gcc.target/powerpc/pr58330.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202829 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.md | 4 +++- gcc/testsuite/ChangeLog | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9597892ccc..051bdc925d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-23 Alan Modra + + PR target/58330 + * config/rs6000/rs6000.md (bswapdi2_64bit): Disable for volatile mems. + 2013-09-23 Alan Modra * config/rs6000/predicates.md (add_cint_operand): New. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 94481232811..ade39ea5f90 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -2110,7 +2110,9 @@ (clobber (match_scratch:DI 3 "=&r,&r,&r")) (clobber (match_scratch:DI 4 "=&r,X,&r"))] "TARGET_POWERPC64 && !TARGET_LDBRX - && (REG_P (operands[0]) || REG_P (operands[1]))" + && (REG_P (operands[0]) || REG_P (operands[1])) + && !(MEM_P (operands[0]) && MEM_VOLATILE_P (operands[0])) + && !(MEM_P (operands[1]) && MEM_VOLATILE_P (operands[1]))" "#" [(set_attr "length" "16,12,36")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aee63870607..eda44e61d59 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-09-23 Alan Modra + + * gcc.target/powerpc/pr58330.c: New. + 2013-09-18 Paolo Carlini PR c++/58457 -- cgit v1.2.3 From 27a5d16a73c9249ef20f97eda34399ac7454e03d Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 23 Sep 2013 14:27:56 +0000 Subject: PR target/58330 * gcc.target/powerpc/pr58330.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/gcc.target/powerpc/pr58330.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr58330.c diff --git a/gcc/testsuite/gcc.target/powerpc/pr58330.c b/gcc/testsuite/gcc.target/powerpc/pr58330.c new file mode 100644 index 00000000000..76983dd55ab --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr58330.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O -mno-popcntb" } */ +/* { dg-final { scan-assembler-not "stwbrx" } } */ + +void +write_reverse (unsigned long *addr, unsigned long val) +{ + unsigned long reverse = __builtin_bswap64 (val); + __atomic_store_n (addr, reverse, __ATOMIC_RELAXED); +} -- cgit v1.2.3 From 66a0cd719dff5d6c0341566cd536f15187eccbc8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Mon, 23 Sep 2013 16:12:27 +0000 Subject: * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy assignment statements. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202834 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gnat.dg/opt28.adb | 31 +++++++++++++++++++++++++++++++ gcc/testsuite/gnat.dg/opt28.ads | 8 ++++++++ gcc/testsuite/gnat.dg/opt28_pkg.ads | 11 +++++++++++ gcc/tree-ssa-ccp.c | 3 +++ 6 files changed, 63 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/opt28.adb create mode 100644 gcc/testsuite/gnat.dg/opt28.ads create mode 100644 gcc/testsuite/gnat.dg/opt28_pkg.ads diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 051bdc925d3..eb5cf9bd17d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-09-23 Eric Botcazou + + * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy + assignment statements. + 2013-09-23 Alan Modra PR target/58330 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eda44e61d59..e35bf72c233 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-23 Eric Botcazou + + * gnat.dg/opt28.ad[sb]: New test. + * gnat.dg/opt28_pkg.ads: New helper. + 2013-09-23 Alan Modra * gcc.target/powerpc/pr58330.c: New. diff --git a/gcc/testsuite/gnat.dg/opt28.adb b/gcc/testsuite/gnat.dg/opt28.adb new file mode 100644 index 00000000000..74a4c5c3be9 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt28.adb @@ -0,0 +1,31 @@ +with Opt28_Pkg; use Opt28_Pkg; + +package body Opt28 is + + function Full_Filename (Filename : String) return String is + Path : constant String := "PATH"; + Posix_Path : constant Posix_String := To_Posix (Path); + begin + + declare + M : constant Posix_String := Value_Of (Posix_Path); + N : constant Posix_String (1 .. M'Length) := M; + Var : constant String := To_String (Str => N); + Start_Pos : Natural := 1; + End_Pos : Natural := 1; + begin + while Start_Pos <= Var'Length loop + End_Pos := Position (Var (Start_Pos .. Var'Length)); + + if Is_File (To_Posix (Var (Start_Pos .. End_Pos - 1) & Filename)) then + return Var (Start_Pos .. End_Pos - 1) & Filename; + else + Start_Pos := End_Pos + 1; + end if; + end loop; + end; + + return ""; + end; + +end Opt28; diff --git a/gcc/testsuite/gnat.dg/opt28.ads b/gcc/testsuite/gnat.dg/opt28.ads new file mode 100644 index 00000000000..4887c214845 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt28.ads @@ -0,0 +1,8 @@ +-- { dg-do compile } +-- { dg-options "-O2" } + +package Opt28 is + + function Full_Filename (Filename : String) return String; + +end Opt28; diff --git a/gcc/testsuite/gnat.dg/opt28_pkg.ads b/gcc/testsuite/gnat.dg/opt28_pkg.ads new file mode 100644 index 00000000000..c3c32fe1c34 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt28_pkg.ads @@ -0,0 +1,11 @@ +package Opt28_Pkg is + + type Posix_String is array (Positive range <>) of aliased Character; + + function To_Posix (Str : String) return Posix_String; + function To_String (Str : Posix_String) return String; + function Is_File (Str : Posix_String) return Boolean; + function Value_Of (Name : Posix_String) return Posix_String; + function Position (In_Line : String) return Natural; + +end Opt28_Pkg; diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index a64bffcaec7..0ad91a9b745 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1707,6 +1707,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var, insert_clobber_before_stack_restore (gimple_phi_result (stmt), var, visited); } + else if (gimple_assign_ssa_name_copy_p (stmt)) + insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var, + visited); else gcc_assert (is_gimple_debug (stmt)); } -- cgit v1.2.3 From 0bd0d724de70cb69945686b783c9384726d03821 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 24 Sep 2013 00:16:37 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202853 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 2b53475b21d..07ae090878a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130923 +20130924 -- cgit v1.2.3 From f44b066447ef2a682a138f5f50d88047c43f5c5b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 25 Sep 2013 00:17:15 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202878 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 07ae090878a..5ef5240213b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130924 +20130925 -- cgit v1.2.3 From 76ed10fc2961938c76cf44d27b1107be5247d299 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 25 Sep 2013 03:28:15 +0000 Subject: compiler: don't permit nil assignment to blank identifier. Fixes https://code.google.com/p/go/issues/detail?id=6005. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202882 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/parse.cc | 5 +---- gcc/go/gofrontend/statements.cc | 14 +++++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 9d112850fee..befe4bc7d83 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -1940,12 +1940,9 @@ Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init, { if (this->gogo_->in_global_scope()) return this->create_dummy_global(type, init, location); - else if (type == NULL) - this->gogo_->add_statement(Statement::make_statement(init, true)); else { - // With both a type and an initializer, create a dummy - // variable so that we will check whether the + // Create a dummy variable so that we will check whether the // initializer can be assigned to the type. Variable* var = new Variable(type, init, false, false, false, location); diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 0261f9d4882..a5102c0c450 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -594,6 +594,15 @@ Assignment_statement::do_check_types(Gogo*) Type* lhs_type = this->lhs_->type(); Type* rhs_type = this->rhs_->type(); + + // Invalid assignment of nil to the blank identifier. + if (lhs_type->is_sink_type() + && rhs_type->is_nil_type()) + { + this->report_error(_("use of untyped nil")); + return; + } + std::string reason; bool ok; if (this->are_hidden_fields_ok_) @@ -975,7 +984,10 @@ Tuple_assignment_statement::do_lower(Gogo*, Named_object*, Block* enclosing, if ((*plhs)->is_sink_expression()) { - b->add_statement(Statement::make_statement(*prhs, true)); + if ((*prhs)->type()->is_nil_type()) + this->report_error(_("use of untyped nil")); + else + b->add_statement(Statement::make_statement(*prhs, true)); continue; } -- cgit v1.2.3 From 4665d3bc4b0087186ac80b12391bc81964ffc3cf Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 26 Sep 2013 00:16:45 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202930 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 5ef5240213b..729bb1ffa39 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130925 +20130926 -- cgit v1.2.3 From 806b43b576c7722e9517b2e393ad8c2ad3c191a4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 27 Sep 2013 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202963 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 729bb1ffa39..d80c11b948c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130926 +20130927 -- cgit v1.2.3 From 8348cc92aa86a08f0479246c0c9f36b0cfaf1652 Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Fri, 27 Sep 2013 16:30:15 +0000 Subject: Backport from mainline. 2013-09-27 Paulo Matos PR middle-end/58463 * gcc.dg/pr58463.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202978 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/pr58463.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr58463.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb5cf9bd17d..88cdd6cf961 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-09-27 Paulo Matos + + Backport from mainline. + + 2013-09-27 Paulo Matos + PR middle-end/58463 + * gcc.dg/pr58463.c: New test. + 2013-09-23 Eric Botcazou * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy diff --git a/gcc/testsuite/gcc.dg/pr58463.c b/gcc/testsuite/gcc.dg/pr58463.c new file mode 100644 index 00000000000..e2b44119347 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58463.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-ealias-details -O2" } */ + +typedef struct +{ + int data16; +} +list_data; +void +fn1 (list_data * p1) +{ + p1->data16 = p1->data16 & 1 & p1->data16 >> 1; +} + +/* { dg-final { cleanup-tree-dump "ealias" } } */ -- cgit v1.2.3 From bfe207e277da360e39c985bfc48a502932a8957b Mon Sep 17 00:00:00 2001 From: Paulo Matos Date: Fri, 27 Sep 2013 16:44:39 +0000 Subject: Backport from mainline. PR middle-end/58463 2013-03-27 Richard Biener PR tree-optimization/56716 * tree-ssa-structalias.c (perform_var_substitution): Adjust dumping for ref nodes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202979 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/tree-ssa-structalias.c | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 88cdd6cf961..611ed38dbdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-09-27 Paulo Matos + + Backport from mainline. + + PR middle-end/58463 + 2013-03-27 Richard Biener + + PR tree-optimization/56716 + * tree-ssa-structalias.c (perform_var_substitution): Adjust + dumping for ref nodes. + 2013-09-27 Paulo Matos Backport from mainline. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 31a4c49c66c..d4b14001179 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2237,18 +2237,37 @@ perform_var_substitution (constraint_graph_t graph) { unsigned j = si->node_mapping[i]; if (j != i) - fprintf (dump_file, "%s node id %d (%s) mapped to SCC leader " - "node id %d (%s)\n", - bitmap_bit_p (graph->direct_nodes, i) - ? "Direct" : "Indirect", i, get_varinfo (i)->name, - j, get_varinfo (j)->name); + { + fprintf (dump_file, "%s node id %d ", + bitmap_bit_p (graph->direct_nodes, i) + ? "Direct" : "Indirect", i); + if (i < FIRST_REF_NODE) + fprintf (dump_file, "\"%s\"", get_varinfo (i)->name); + else + fprintf (dump_file, "\"*%s\"", + get_varinfo (i - FIRST_REF_NODE)->name); + fprintf (dump_file, " mapped to SCC leader node id %d ", j); + if (j < FIRST_REF_NODE) + fprintf (dump_file, "\"%s\"\n", get_varinfo (j)->name); + else + fprintf (dump_file, "\"*%s\"\n", + get_varinfo (j - FIRST_REF_NODE)->name); + } else - fprintf (dump_file, - "Equivalence classes for %s node id %d (%s): pointer %d" - ", location %d\n", - bitmap_bit_p (graph->direct_nodes, i) - ? "direct" : "indirect", i, get_varinfo (i)->name, - graph->pointer_label[i], graph->loc_label[i]); + { + fprintf (dump_file, + "Equivalence classes for %s node id %d ", + bitmap_bit_p (graph->direct_nodes, i) + ? "direct" : "indirect", i); + if (i < FIRST_REF_NODE) + fprintf (dump_file, "\"%s\"", get_varinfo (i)->name); + else + fprintf (dump_file, "\"*%s\"", + get_varinfo (i - FIRST_REF_NODE)->name); + fprintf (dump_file, + ": pointer %d, location %d\n", + graph->pointer_label[i], graph->loc_label[i]); + } } /* Quickly eliminate our non-pointer variables. */ -- cgit v1.2.3 From 2219e47848a8d38656cd98d370b0919580bcc30e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 27 Sep 2013 17:54:20 +0000 Subject: reflect: Implement MakeFunc for amd64. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202983 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/Makefile.am | 16 ++ libgo/Makefile.in | 37 ++- libgo/go/reflect/all_test.go | 12 +- libgo/go/reflect/makefunc.go | 24 +- libgo/go/reflect/makefunc_amd64.S | 107 ++++++++ libgo/go/reflect/makefunc_dummy.c | 12 + libgo/go/reflect/makefuncgo_amd64.go | 487 +++++++++++++++++++++++++++++++++++ libgo/go/reflect/value.go | 69 ----- 8 files changed, 676 insertions(+), 88 deletions(-) create mode 100644 libgo/go/reflect/makefunc_amd64.S create mode 100644 libgo/go/reflect/makefunc_dummy.c create mode 100644 libgo/go/reflect/makefuncgo_amd64.go diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 6a81d336819..6d452f4f5cd 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -895,9 +895,21 @@ go_path_files = \ go/path/match.go \ go/path/path.go +if LIBGO_IS_X86_64 +go_reflect_makefunc_file = \ + go/reflect/makefuncgo_amd64.go +go_reflect_makefunc_s_file = \ + go/reflect/makefunc_amd64.S +else +go_reflect_makefunc_file = +go_reflect_makefunc_s_file = \ + go/reflect/makefunc_dummy.c +endif + go_reflect_files = \ go/reflect/deepequal.go \ go/reflect/makefunc.go \ + $(go_reflect_makefunc_file) \ go/reflect/type.go \ go/reflect/value.go @@ -1761,6 +1773,7 @@ libgo_go_objs = \ os.lo \ path.lo \ reflect-go.lo \ + reflect/makefunc.lo \ regexp.lo \ runtime-go.lo \ sort.lo \ @@ -2147,6 +2160,9 @@ reflect-go.lo: $(go_reflect_files) $(BUILDPACKAGE) reflect/check: $(CHECK_DEPS) @$(CHECK) +reflect/makefunc.lo: $(go_reflect_makefunc_s_file) + @$(MKDIR_P) reflect + $(LTCOMPILE) -c -o $@ $< .PHONY: reflect/check @go_include@ regexp.lo.dep diff --git a/libgo/Makefile.in b/libgo/Makefile.in index eccc72d2e3c..b72e8aa559a 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -134,17 +134,17 @@ am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \ errors.lo expvar.lo flag.lo fmt.lo hash.lo html.lo image.lo \ io.lo log.lo math.lo mime.lo net.lo os.lo path.lo \ - reflect-go.lo regexp.lo runtime-go.lo sort.lo strconv.lo \ - strings.lo sync.lo syscall.lo syscall/errno.lo \ - syscall/signame.lo syscall/wait.lo testing.lo time-go.lo \ - unicode.lo archive/tar.lo archive/zip.lo compress/bzip2.lo \ - compress/flate.lo compress/gzip.lo compress/lzw.lo \ - compress/zlib.lo container/heap.lo container/list.lo \ - container/ring.lo crypto/aes.lo crypto/cipher.lo crypto/des.lo \ - crypto/dsa.lo crypto/ecdsa.lo crypto/elliptic.lo \ - crypto/hmac.lo crypto/md5.lo crypto/rand.lo crypto/rc4.lo \ - crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo crypto/sha512.lo \ - crypto/subtle.lo crypto/tls.lo crypto/x509.lo \ + reflect-go.lo reflect/makefunc.lo regexp.lo runtime-go.lo \ + sort.lo strconv.lo strings.lo sync.lo syscall.lo \ + syscall/errno.lo syscall/signame.lo syscall/wait.lo testing.lo \ + time-go.lo unicode.lo archive/tar.lo archive/zip.lo \ + compress/bzip2.lo compress/flate.lo compress/gzip.lo \ + compress/lzw.lo compress/zlib.lo container/heap.lo \ + container/list.lo container/ring.lo crypto/aes.lo \ + crypto/cipher.lo crypto/des.lo crypto/dsa.lo crypto/ecdsa.lo \ + crypto/elliptic.lo crypto/hmac.lo crypto/md5.lo crypto/rand.lo \ + crypto/rc4.lo crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo \ + crypto/sha512.lo crypto/subtle.lo crypto/tls.lo crypto/x509.lo \ crypto/x509/pkix.lo database/sql.lo database/sql/driver.lo \ debug/dwarf.lo debug/elf.lo debug/gosym.lo debug/macho.lo \ debug/pe.lo encoding/ascii85.lo encoding/asn1.lo \ @@ -1087,9 +1087,20 @@ go_path_files = \ go/path/match.go \ go/path/path.go +@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = +@LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_file = \ +@LIBGO_IS_X86_64_TRUE@ go/reflect/makefuncgo_amd64.go + +@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \ +@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c + +@LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_s_file = \ +@LIBGO_IS_X86_64_TRUE@ go/reflect/makefunc_amd64.S + go_reflect_files = \ go/reflect/deepequal.go \ go/reflect/makefunc.go \ + $(go_reflect_makefunc_file) \ go/reflect/type.go \ go/reflect/value.go @@ -1846,6 +1857,7 @@ libgo_go_objs = \ os.lo \ path.lo \ reflect-go.lo \ + reflect/makefunc.lo \ regexp.lo \ runtime-go.lo \ sort.lo \ @@ -4499,6 +4511,9 @@ reflect-go.lo: $(go_reflect_files) $(BUILDPACKAGE) reflect/check: $(CHECK_DEPS) @$(CHECK) +reflect/makefunc.lo: $(go_reflect_makefunc_s_file) + @$(MKDIR_P) reflect + $(LTCOMPILE) -c -o $@ $< .PHONY: reflect/check @go_include@ regexp.lo.dep diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go index 6528e60459b..fb25130e835 100644 --- a/libgo/go/reflect/all_test.go +++ b/libgo/go/reflect/all_test.go @@ -1430,11 +1430,13 @@ func TestFunc(t *testing.T) { } } -/* - -Not yet implemented for gccgo. - func TestMakeFunc(t *testing.T) { + switch runtime.GOARCH { + case "amd64": + default: + t.Skip("MakeFunc not implemented for " + runtime.GOARCH) + } + f := dummy fv := MakeFunc(TypeOf(f), func(in []Value) []Value { return in }) ValueOf(&f).Elem().Set(fv) @@ -1452,8 +1454,6 @@ func TestMakeFunc(t *testing.T) { } } -*/ - type Point struct { x, y int } diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go index f03beb34483..7253a6398a6 100644 --- a/libgo/go/reflect/makefunc.go +++ b/libgo/go/reflect/makefunc.go @@ -7,6 +7,7 @@ package reflect import ( + "runtime" "unsafe" ) @@ -45,14 +46,33 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value { panic("reflect: call of MakeFunc with non-Func type") } + switch runtime.GOARCH { + case "amd64": + default: + panic("reflect.MakeFunc not implemented for " + runtime.GOARCH) + } + t := typ.common() ftyp := (*funcType)(unsafe.Pointer(t)) - _, _ = t, ftyp + // Indirect Go func value (dummy) to obtain + // actual code address. (A Go func value is a pointer + // to a C function pointer. http://golang.org/s/go11func.) + dummy := makeFuncStub + code := **(**uintptr)(unsafe.Pointer(&dummy)) - panic("reflect MakeFunc not implemented") + impl := &makeFuncImpl{code: code, typ: ftyp, fn: fn} + + return Value{t, unsafe.Pointer(impl), flag(Func) << flagKindShift} } +// makeFuncStub is an assembly function that is the code half of +// the function returned from MakeFunc. It expects a *callReflectFunc +// as its context register, and its job is to invoke callReflect(ctxt, frame) +// where ctxt is the context register and frame is a pointer to the first +// word in the passed-in argument frame. +func makeFuncStub() + // makeMethodValue converts v from the rcvr+method index representation // of a method value to an actual method func value, which is // basically the receiver value with a special bit set, into a true diff --git a/libgo/go/reflect/makefunc_amd64.S b/libgo/go/reflect/makefunc_amd64.S new file mode 100644 index 00000000000..319aa18505c --- /dev/null +++ b/libgo/go/reflect/makefunc_amd64.S @@ -0,0 +1,107 @@ +# Copyright 2013 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# MakeFunc amd64 assembly code. + + .global reflect.makeFuncStub + +#ifdef __ELF__ + .type reflect.makeFuncStub,@function +#endif + +reflect.makeFuncStub: + .cfi_startproc + + # Store all the parameter registers in a struct that looks + # like: + # struct { + # rax uint64 // 0x0 + # rdi uint64 // 0x8 + # rsi uint64 // 0x10 + # rdx uint64 // 0x18 + # rcx uint64 // 0x20 + # r8 uint64 // 0x28 + # r9 uint64 // 0x30 + # rsp uint64 // 0x38 Pointer to arguments on stack. + # xmm0 [2]uint64 // 0x40 + # xmm1 [2]uint64 // 0x50 + # xmm2 [2]uint64 // 0x60 + # xmm3 [2]uint64 // 0x70 + # xmm4 [2]uint64 // 0x80 + # xmm5 [2]uint64 // 0x90 + # xmm6 [2]uint64 // 0xa0 + # xmm7 [2]uint64 // 0xb0 + # }; + + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + + subq $0xc0, %rsp # Space for struct on stack. + + movq %rax, 0x0(%rsp) + movq %rdi, 0x8(%rsp) + movq %rsi, 0x10(%rsp) + movq %rdx, 0x18(%rsp) + movq %rcx, 0x20(%rsp) + movq %r8, 0x28(%rsp) + movq %r9, 0x30(%rsp) + leaq 16(%rbp), %rax + movq %rax, 0x38(%rsp) + movdqa %xmm0, 0x40(%rsp) + movdqa %xmm1, 0x50(%rsp) + movdqa %xmm2, 0x60(%rsp) + movdqa %xmm3, 0x70(%rsp) + movdqa %xmm4, 0x80(%rsp) + movdqa %xmm5, 0x90(%rsp) + movdqa %xmm6, 0xa0(%rsp) + movdqa %xmm7, 0xb0(%rsp) + + # Get function type. +#ifdef __PIC__ + call __go_get_closure@PLT +#else + call __go_get_closure +#endif + movq %rax, %rsi + + movq %rsp, %rdi + +#ifdef __PIC__ + call reflect.MakeFuncStubGo@PLT +#else + call reflect.MakeFuncStubGo +#endif + + # The structure will be updated with any return values. Load + # all possible return registers before returning to the caller. + + movq 0x0(%rsp), %rax + movq 0x18(%rsp), %rdx + movq 0x8(%rsp), %rdi + movq 0x10(%rsp), %rsi + movdqa 0x40(%rsp), %xmm0 + movdqa 0x50(%rsp), %xmm1 + + # long double values are returned on the floating point stack, + # but we don't worry about that since Go doesn't have a long + # double type. + + leave + .cfi_def_cfa %rsp, 8 + + ret + + .cfi_endproc +#ifdef __ELF__ + .size reflect.makeFuncStub, . - reflect.makeFuncStub +#endif + +#ifdef __ELF__ + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits + .section .note.GNU-no-split-stack,"",@progbits +#endif diff --git a/libgo/go/reflect/makefunc_dummy.c b/libgo/go/reflect/makefunc_dummy.c new file mode 100644 index 00000000000..aba48df3eb8 --- /dev/null +++ b/libgo/go/reflect/makefunc_dummy.c @@ -0,0 +1,12 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64 + +// Dummy function for processors without makefunc support. + +void makeFuncStub () __asm__ ("reflect.makeFuncStub"); +void makeFuncStub () +{ +} diff --git a/libgo/go/reflect/makefuncgo_amd64.go b/libgo/go/reflect/makefuncgo_amd64.go new file mode 100644 index 00000000000..bdc65560506 --- /dev/null +++ b/libgo/go/reflect/makefuncgo_amd64.go @@ -0,0 +1,487 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// MakeFunc amd64 implementation. + +package reflect + +import "unsafe" + +// The assembler stub will pass a pointer to this structure. +// This will come in holding all the registers that might hold +// function parameters. On return we will set the registers that +// might hold result values. +type amd64Regs struct { + rax uint64 + rdi uint64 + rsi uint64 + rdx uint64 + rcx uint64 + r8 uint64 + r9 uint64 + rsp uint64 + xmm0 [2]uint64 + xmm1 [2]uint64 + xmm2 [2]uint64 + xmm3 [2]uint64 + xmm4 [2]uint64 + xmm5 [2]uint64 + xmm6 [2]uint64 + xmm7 [2]uint64 +} + +// Argument classifications. The amd64 ELF ABI uses several more, but +// these are the only ones that arise for Go types. +type amd64Class int + +const ( + amd64Integer amd64Class = iota + amd64SSE + amd64NoClass + amd64Memory +) + +// amd64Classify returns the one or two register classes needed to +// pass the value of type. Go types never need more than two +// registers. amd64Memory means the value is stored in memory. +// amd64NoClass means the register is not used. +func amd64Classify(typ *rtype) (amd64Class, amd64Class) { + switch typ.Kind() { + default: + panic("internal error--unknown kind in amd64Classify") + + case Bool, Int, Int8, Int16, Int32, Int64, + Uint, Uint8, Uint16, Uint32, Uint64, + Uintptr, Chan, Func, Map, Ptr, UnsafePointer: + + return amd64Integer, amd64NoClass + + case Float32, Float64, Complex64: + return amd64SSE, amd64NoClass + + case Complex128: + return amd64SSE, amd64SSE + + case Array: + if typ.size == 0 { + return amd64NoClass, amd64NoClass + } else if typ.size > 16 { + return amd64Memory, amd64NoClass + } + atyp := (*arrayType)(unsafe.Pointer(typ)) + eclass1, eclass2 := amd64Classify(atyp.elem) + if eclass1 == amd64Memory { + return amd64Memory, amd64NoClass + } + if eclass2 == amd64NoClass && typ.size > 8 { + eclass2 = eclass1 + } + return eclass1, eclass2 + + case Interface: + return amd64Integer, amd64Integer + + case Slice: + return amd64Memory, amd64NoClass + + case String: + return amd64Integer, amd64Integer + + case Struct: + if typ.size == 0 { + return amd64NoClass, amd64NoClass + } else if typ.size > 16 { + return amd64Memory, amd64NoClass + } + var first, second amd64Class + f := amd64NoClass + onFirst := true + styp := (*structType)(unsafe.Pointer(typ)) + for _, field := range styp.fields { + if onFirst && field.offset >= 8 { + first = f + f = amd64NoClass + onFirst = false + } + fclass1, fclass2 := amd64Classify(field.typ) + f = amd64MergeClasses(f, fclass1) + if fclass2 != amd64NoClass { + if !onFirst { + panic("amd64Classify inconsistent") + } + first = f + f = fclass2 + onFirst = false + } + } + if onFirst { + first = f + second = amd64NoClass + } else { + second = f + } + if first == amd64Memory || second == amd64Memory { + return amd64Memory, amd64NoClass + } + return first, second + } +} + +// amd64MergeClasses merges two register classes as described in the +// amd64 ELF ABI. +func amd64MergeClasses(c1, c2 amd64Class) amd64Class { + switch { + case c1 == c2: + return c1 + case c1 == amd64NoClass: + return c2 + case c2 == amd64NoClass: + return c1 + case c1 == amd64Memory || c2 == amd64Memory: + return amd64Memory + case c1 == amd64Integer || c2 == amd64Integer: + return amd64Integer + default: + return amd64SSE + } +} + +// MakeFuncStubGo implements the amd64 calling convention for +// MakeFunc. This should not be called. It is exported so that +// assembly code can call it. + +func MakeFuncStubGo(regs *amd64Regs, c *makeFuncImpl) { + ftyp := c.typ + + // See if the result requires a struct. If it does, the first + // parameter is a pointer to the struct. + var ret1, ret2 amd64Class + switch len(ftyp.out) { + case 0: + ret1, ret2 = amd64NoClass, amd64NoClass + case 1: + ret1, ret2 = amd64Classify(ftyp.out[0]) + default: + off := uintptr(0) + f := amd64NoClass + onFirst := true + for _, rt := range ftyp.out { + off = align(off, uintptr(rt.fieldAlign)) + + if onFirst && off >= 8 { + ret1 = f + f = amd64NoClass + onFirst = false + } + + off += rt.size + if off > 16 { + break + } + + fclass1, fclass2 := amd64Classify(rt) + f = amd64MergeClasses(f, fclass1) + if fclass2 != amd64NoClass { + if !onFirst { + panic("amd64Classify inconsistent") + } + ret1 = f + f = fclass2 + onFirst = false + } + } + if off > 16 { + ret1, ret2 = amd64Memory, amd64NoClass + } else { + if onFirst { + ret1, ret2 = f, amd64NoClass + } else { + ret2 = f + } + } + if ret1 == amd64Memory || ret2 == amd64Memory { + ret1, ret2 = amd64Memory, amd64NoClass + } + } + + in := make([]Value, 0, len(ftyp.in)) + intreg := 0 + ssereg := 0 + ap := uintptr(regs.rsp) + + maxIntregs := 6 // When we support Windows, this would be 4. + maxSSEregs := 8 + + if ret1 == amd64Memory { + // We are returning a value in memory, which means + // that the first argument is a hidden parameter + // pointing to that return area. + intreg++ + } + +argloop: + for _, rt := range ftyp.in { + c1, c2 := amd64Classify(rt) + + fl := flag(rt.Kind()) << flagKindShift + if c2 == amd64NoClass { + + // Argument is passed in a single register or + // in memory. + + switch c1 { + case amd64NoClass: + v := Value{rt, nil, fl | flagIndir} + in = append(in, v) + continue argloop + case amd64Integer: + if intreg < maxIntregs { + reg := amd64IntregVal(regs, intreg) + iw := unsafe.Pointer(reg) + if k := rt.Kind(); k != Ptr && k != UnsafePointer { + iw = unsafe.Pointer(®) + fl |= flagIndir + } + v := Value{rt, iw, fl} + in = append(in, v) + intreg++ + continue argloop + } + case amd64SSE: + if ssereg < maxSSEregs { + reg := amd64SSEregVal(regs, ssereg) + v := Value{rt, unsafe.Pointer(®), fl | flagIndir} + in = append(in, v) + ssereg++ + continue argloop + } + } + + in, ap = amd64Memarg(in, ap, rt) + continue argloop + } + + // Argument is passed in two registers. + + nintregs := 0 + nsseregs := 0 + switch c1 { + case amd64Integer: + nintregs++ + case amd64SSE: + nsseregs++ + default: + panic("inconsistent") + } + switch c2 { + case amd64Integer: + nintregs++ + case amd64SSE: + nsseregs++ + default: + panic("inconsistent") + } + + // If the whole argument does not fit in registers, it + // is passed in memory. + + if intreg+nintregs > maxIntregs || ssereg+nsseregs > maxSSEregs { + in, ap = amd64Memarg(in, ap, rt) + continue argloop + } + + var word1, word2 uintptr + switch c1 { + case amd64Integer: + word1 = amd64IntregVal(regs, intreg) + intreg++ + case amd64SSE: + word1 = amd64SSEregVal(regs, ssereg) + ssereg++ + } + switch c2 { + case amd64Integer: + word2 = amd64IntregVal(regs, intreg) + intreg++ + case amd64SSE: + word2 = amd64SSEregVal(regs, ssereg) + ssereg++ + } + + p := unsafe_New(rt) + *(*uintptr)(p) = word1 + *(*uintptr)(unsafe.Pointer(uintptr(p) + ptrSize)) = word2 + v := Value{rt, p, fl | flagIndir} + in = append(in, v) + } + + // All the real arguments have been found and turned into + // Value's. Call the real function. + + out := c.fn(in) + + if len(out) != len(ftyp.out) { + panic("reflect: wrong return count from function created by MakeFunc") + } + + for i, typ := range ftyp.out { + v := out[i] + if v.typ != typ { + panic("reflect: function created by MakeFunc using " + funcName(c.fn) + + " returned wrong type: have " + + out[i].typ.String() + " for " + typ.String()) + } + if v.flag&flagRO != 0 { + panic("reflect: function created by MakeFunc using " + funcName(c.fn) + + " returned value obtained from unexported field") + } + } + + if ret1 == amd64NoClass { + return + } + + if ret1 == amd64Memory { + // The address of the memory area was passed as a + // hidden parameter in %rdi. + ptr := unsafe.Pointer(uintptr(regs.rdi)) + off := uintptr(0) + for i, typ := range ftyp.out { + v := out[i] + off = align(off, uintptr(typ.fieldAlign)) + addr := unsafe.Pointer(uintptr(ptr) + off) + if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) { + storeIword(addr, iword(v.val), typ.size) + } else { + memmove(addr, v.val, typ.size) + } + off += typ.size + } + return + } + + if len(out) == 1 && ret2 == amd64NoClass { + v := out[0] + w := v.iword() + if v.Kind() != Ptr && v.Kind() != UnsafePointer { + w = loadIword(unsafe.Pointer(w), v.typ.size) + } + switch ret1 { + case amd64Integer: + regs.rax = uint64(uintptr(w)) + case amd64SSE: + regs.xmm0[0] = uint64(uintptr(w)) + regs.xmm0[1] = 0 + default: + panic("inconsistency") + } + return + } + + var buf [2]unsafe.Pointer + ptr := unsafe.Pointer(&buf[0]) + off := uintptr(0) + for i, typ := range ftyp.out { + v := out[i] + off = align(off, uintptr(typ.fieldAlign)) + addr := unsafe.Pointer(uintptr(ptr) + off) + if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) { + storeIword(addr, iword(v.val), typ.size) + } else { + memmove(addr, v.val, typ.size) + } + off += uintptr(typ.size) + } + + switch ret1 { + case amd64Integer: + regs.rax = *(*uint64)(unsafe.Pointer(&buf[0])) + case amd64SSE: + regs.xmm0[0] = *(*uint64)(unsafe.Pointer(&buf[0])) + regs.xmm0[1] = 0 + default: + panic("inconsistency") + } + + switch ret2 { + case amd64Integer: + reg := *(*uint64)(unsafe.Pointer(&buf[1])) + if ret1 == amd64Integer { + regs.rdx = reg + } else { + regs.rax = reg + } + case amd64SSE: + reg := *(*uint64)(unsafe.Pointer(&buf[1])) + if ret1 == amd64Integer { + regs.xmm0[0] = reg + regs.xmm0[1] = 0 + } else { + regs.xmm1[0] = reg + regs.xmm1[1] = 0 + } + case amd64NoClass: + default: + panic("inconsistency") + } +} + +// The amd64Memarg function adds an argument passed in memory. +func amd64Memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) { + ap = align(ap, ptrSize) + ap = align(ap, uintptr(rt.align)) + p := Value{rt, unsafe.Pointer(ap), flag(rt.Kind()< 2 } -// callReflect is the call implementation used by a function -// returned by MakeFunc. In many ways it is the opposite of the -// method Value.call above. The method above converts a call using Values -// into a call of a function with a concrete argument frame, while -// callReflect converts a call of a function with a concrete argument -// frame into a call using Values. -// It is in this file so that it can be next to the call method above. -// The remainder of the MakeFunc implementation is in makefunc.go. -func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer) { - ftyp := ctxt.typ - f := ctxt.fn - - // Copy argument frame into Values. - ptr := frame - off := uintptr(0) - in := make([]Value, 0, len(ftyp.in)) - for _, arg := range ftyp.in { - typ := arg - off += -off & uintptr(typ.align-1) - v := Value{typ, nil, flag(typ.Kind()) << flagKindShift} - if typ.size <= ptrSize { - // value fits in word. - v.val = unsafe.Pointer(loadIword(unsafe.Pointer(uintptr(ptr)+off), typ.size)) - } else { - // value does not fit in word. - // Must make a copy, because f might keep a reference to it, - // and we cannot let f keep a reference to the stack frame - // after this function returns, not even a read-only reference. - v.val = unsafe_New(typ) - memmove(v.val, unsafe.Pointer(uintptr(ptr)+off), typ.size) - v.flag |= flagIndir - } - in = append(in, v) - off += typ.size - } - - // Call underlying function. - out := f(in) - if len(out) != len(ftyp.out) { - panic("reflect: wrong return count from function created by MakeFunc") - } - - // Copy results back into argument frame. - if len(ftyp.out) > 0 { - off += -off & (ptrSize - 1) - for i, arg := range ftyp.out { - typ := arg - v := out[i] - if v.typ != typ { - panic("reflect: function created by MakeFunc using " + funcName(f) + - " returned wrong type: have " + - out[i].typ.String() + " for " + typ.String()) - } - if v.flag&flagRO != 0 { - panic("reflect: function created by MakeFunc using " + funcName(f) + - " returned value obtained from unexported field") - } - off += -off & uintptr(typ.align-1) - addr := unsafe.Pointer(uintptr(ptr) + off) - if v.flag&flagIndir == 0 { - storeIword(addr, iword(v.val), typ.size) - } else { - memmove(addr, v.val, typ.size) - } - off += typ.size - } - } -} - // methodReceiver returns information about the receiver // described by v. The Value v may or may not have the // flagMethod bit set, so the kind cached in v.flag should -- cgit v1.2.3 From f193dc68ba2fe12bc475634b228a15425d049d25 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 27 Sep 2013 21:34:43 +0000 Subject: reflect: Implement MakeFunc for 386. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202994 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/Makefile.am | 7 ++ libgo/Makefile.in | 12 +++- libgo/go/reflect/all_test.go | 2 +- libgo/go/reflect/makefunc.go | 2 +- libgo/go/reflect/makefunc_386.S | 111 ++++++++++++++++++++++++++++++ libgo/go/reflect/makefuncgo_386.go | 135 +++++++++++++++++++++++++++++++++++++ 6 files changed, 264 insertions(+), 5 deletions(-) create mode 100644 libgo/go/reflect/makefunc_386.S create mode 100644 libgo/go/reflect/makefuncgo_386.go diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 6d452f4f5cd..c81c66cb07f 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -901,10 +901,17 @@ go_reflect_makefunc_file = \ go_reflect_makefunc_s_file = \ go/reflect/makefunc_amd64.S else +if LIBGO_IS_386 +go_reflect_makefunc_file = \ + go/reflect/makefuncgo_386.go +go_reflect_makefunc_s_file = \ + go/reflect/makefunc_386.S +else go_reflect_makefunc_file = go_reflect_makefunc_s_file = \ go/reflect/makefunc_dummy.c endif +endif go_reflect_files = \ go/reflect/deepequal.go \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index b72e8aa559a..9e31e8ca28e 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1087,12 +1087,18 @@ go_path_files = \ go/path/match.go \ go/path/path.go -@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = +@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = +@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = \ +@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefuncgo_386.go + @LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_file = \ @LIBGO_IS_X86_64_TRUE@ go/reflect/makefuncgo_amd64.go -@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \ -@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c +@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \ +@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c + +@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \ +@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_386.S @LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_s_file = \ @LIBGO_IS_X86_64_TRUE@ go/reflect/makefunc_amd64.S diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go index fb25130e835..1fed58570f2 100644 --- a/libgo/go/reflect/all_test.go +++ b/libgo/go/reflect/all_test.go @@ -1432,7 +1432,7 @@ func TestFunc(t *testing.T) { func TestMakeFunc(t *testing.T) { switch runtime.GOARCH { - case "amd64": + case "amd64", "386": default: t.Skip("MakeFunc not implemented for " + runtime.GOARCH) } diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go index 7253a6398a6..3e0a79258e6 100644 --- a/libgo/go/reflect/makefunc.go +++ b/libgo/go/reflect/makefunc.go @@ -47,7 +47,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value { } switch runtime.GOARCH { - case "amd64": + case "amd64", "386": default: panic("reflect.MakeFunc not implemented for " + runtime.GOARCH) } diff --git a/libgo/go/reflect/makefunc_386.S b/libgo/go/reflect/makefunc_386.S new file mode 100644 index 00000000000..f2f2fbe1a95 --- /dev/null +++ b/libgo/go/reflect/makefunc_386.S @@ -0,0 +1,111 @@ +# Copyright 2013 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +# MakeFunc 386 assembly code. + + .global reflect.makeFuncStub + +#ifdef __ELF__ + .type reflect.makeFuncStub,@function +#endif + +reflect.makeFuncStub: + .cfi_startproc + + # Go does not provide any equivalent to the regparm function + # attribute, so on Go we do not need to worry about passing + # parameters in registers. We just pass a pointer to the + # arguments on the stack. + # + # We do need to pick up the return values, though, so we pass + # a pointer to a struct that looks like this. + # struct { + # esp uint32 // 0x0 + # eax uint32 // 0x4 + # st0 uint64 // 0x8 + # } + + pushl %ebp + .cfi_def_cfa_offset 8 + .cfi_offset %ebp, -8 + movl %esp, %ebp + .cfi_def_cfa_register %ebp + + pushl %ebx # In case this is PIC. + + subl $36, %esp # Enough for args and to align stack. + .cfi_offset %ebx, -12 + +#ifdef __PIC__ + call __x86.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx +#endif + + leal 8(%ebp), %eax # Set esp field in struct. + movl %eax, -24(%ebp) + +#ifdef __PIC__ + call __go_get_closure@PLT +#else + call __go_get_closure +#endif + + movl %eax, 4(%esp) + + leal -24(%ebp), %eax + movl %eax, (%esp) + +#ifdef __PIC__ + call reflect.MakeFuncStubGo@PLT +#else + call reflect.MakeFuncStubGo +#endif + + # Set return registers. + + movl -20(%ebp), %eax + fldl -16(%ebp) + +#ifdef __SSE2__ + # In case we are compiling with -msseregparm. This won't work + # correctly if only SSE1 is supported, but that seems unlikely. + movsd -16(%ebp), %xmm0 +#endif + + addl $36, %esp + popl %ebx + .cfi_restore %ebx + popl %ebp + .cfi_restore %ebp + .cfi_def_cfa %esp, 4 + + ret + .cfi_endproc + +#ifdef __ELF__ + .size reflect.makeFuncStub, . - reflect.makeFuncStub +#endif + +#ifdef __PIC__ + .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat + .globl __x86.get_pc_thunk.bx + .hidden __x86.get_pc_thunk.bx +#ifdef __ELF__ + .type __x86.get_pc_thunk.bx, @function +#endif +__x86.get_pc_thunk.bx: + .cfi_startproc + movl (%esp), %ebx + ret + .cfi_endproc +#ifdef __ELF__ + .size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx +#endif +#endif + +#ifdef __ELF__ + .section .note.GNU-stack,"",@progbits + .section .note.GNU-split-stack,"",@progbits + .section .note.GNU-no-split-stack,"",@progbits +#endif diff --git a/libgo/go/reflect/makefuncgo_386.go b/libgo/go/reflect/makefuncgo_386.go new file mode 100644 index 00000000000..0fac1f488a4 --- /dev/null +++ b/libgo/go/reflect/makefuncgo_386.go @@ -0,0 +1,135 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// MakeFunc 386 implementation. + +package reflect + +import "unsafe" + +// The assembler stub will pass a pointer to this structure. We +// assume that no parameters are passed in registers--that is, we do +// not support the -mregparm option. On return we will set the +// registers that might hold result values. +type i386Regs struct { + esp uint32 + eax uint32 // Value to return in %eax. + st0 uint64 // Value to return in %st(0). +} + +// MakeFuncStubGo implements the 386 calling convention for MakeFunc. +// This should not be called. It is exported so that assembly code +// can call it. + +func MakeFuncStubGo(regs *i386Regs, c *makeFuncImpl) { + ftyp := c.typ + + // See if the result requires a struct. If it does, the first + // parameter is a pointer to the struct. + retStruct := false + retEmpty := false + switch len(ftyp.out) { + case 0: + retEmpty = true + case 1: + if ftyp.out[0].size == 0 { + retEmpty = true + } else { + switch ftyp.out[0].Kind() { + case Complex64, Complex128, Array, Interface, Slice, String, Struct: + retStruct = true + } + } + default: + size := uintptr(0) + for _, typ := range ftyp.out { + size += typ.size + } + if size == 0 { + retEmpty = true + } else { + retStruct = true + } + } + + in := make([]Value, 0, len(ftyp.in)) + ap := uintptr(regs.esp) + + var retPtr unsafe.Pointer + if retStruct { + retPtr = *(*unsafe.Pointer)(unsafe.Pointer(ap)) + ap += ptrSize + } + + for _, rt := range ftyp.in { + ap = align(ap, ptrSize) + + // We have to copy the argument onto the heap in case + // the function hangs on the reflect.Value we pass it. + p := unsafe_New(rt) + memmove(p, unsafe.Pointer(ap), rt.size) + + v := Value{rt, p, flag(rt.Kind()< Date: Fri, 27 Sep 2013 22:13:27 +0000 Subject: reflect: Copy stack values onto heap in amd64 MakeFunc. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@202996 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/reflect/makefuncgo_amd64.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libgo/go/reflect/makefuncgo_amd64.go b/libgo/go/reflect/makefuncgo_amd64.go index bdc65560506..ecc50a42520 100644 --- a/libgo/go/reflect/makefuncgo_amd64.go +++ b/libgo/go/reflect/makefuncgo_amd64.go @@ -431,8 +431,14 @@ argloop: func amd64Memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) { ap = align(ap, ptrSize) ap = align(ap, uintptr(rt.align)) - p := Value{rt, unsafe.Pointer(ap), flag(rt.Kind()< Date: Sat, 28 Sep 2013 00:16:54 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203001 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d80c11b948c..ea0f9f0a84b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130927 +20130928 -- cgit v1.2.3 From 6ed2a218f40cabdd11084b75b5528b2940d39dea Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 28 Sep 2013 20:23:56 +0000 Subject: compiler: Avoid knockon errors for invalid uses of _. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203007 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/gogo-tree.cc | 6 ++++++ gcc/go/gofrontend/gogo.cc | 21 +++++++++++++++++++++ gcc/go/gofrontend/gogo.h | 10 ++++++++++ gcc/go/gofrontend/parse.cc | 10 +++++----- gcc/go/gofrontend/types.cc | 6 +++++- 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 7813cc18822..a95f2901509 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -1061,6 +1061,12 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) if (this->tree_ != NULL_TREE) return this->tree_; + if (Gogo::is_erroneous_name(this->name_)) + { + this->tree_ = error_mark_node; + return error_mark_node; + } + tree name; if (this->classification_ == NAMED_OBJECT_TYPE) name = NULL_TREE; diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 17cbb6b9b49..9f918cb81c7 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1192,6 +1192,27 @@ Gogo::record_interface_type(Interface_type* itype) this->interface_types_.push_back(itype); } +// Return an erroneous name that indicates that an error has already +// been reported. + +std::string +Gogo::erroneous_name() +{ + static int erroneous_count; + char name[50]; + snprintf(name, sizeof name, "$erroneous%d", erroneous_count); + ++erroneous_count; + return name; +} + +// Return whether a name is an erroneous name. + +bool +Gogo::is_erroneous_name(const std::string& name) +{ + return name.compare(0, 10, "$erroneous") == 0; +} + // Return a name for a thunk object. std::string diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index 6a87f2d562c..23968d4a191 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -387,6 +387,16 @@ class Gogo void mark_locals_used(); + // Return a name to use for an error case. This should only be used + // after reporting an error, and is used to avoid useless knockon + // errors. + static std::string + erroneous_name(); + + // Return whether the name indicates an error. + static bool + is_erroneous_name(const std::string&); + // Return a name to use for a thunk function. A thunk function is // one we create during the compilation, for a go statement or a // defer statement or a method expression. diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index befe4bc7d83..e68f1753f87 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -213,7 +213,7 @@ Parse::qualified_ident(std::string* pname, Named_object** ppackage) if (name == "_") { error_at(this->location(), "invalid use of %<_%>"); - name = "blank"; + name = Gogo::erroneous_name(); } if (package->name() == this->gogo_->package_name()) @@ -3104,7 +3104,7 @@ Parse::selector(Expression* left, bool* is_type_switch) if (token->identifier() == "_") { error_at(this->location(), "invalid use of %<_%>"); - name = this->gogo_->pack_hidden_name("blank", false); + name = Gogo::erroneous_name(); } this->advance_token(); return Expression::make_selector(left, name, location); @@ -4929,7 +4929,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val, { error_at(recv_var_loc, "no new variables on left side of %<:=%>"); - recv_var = "blank"; + recv_var = Gogo::erroneous_name(); } *is_send = false; *varname = gogo->pack_hidden_name(recv_var, is_rv_exported); @@ -4965,7 +4965,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val, { error_at(recv_var_loc, "no new variables on left side of %<:=%>"); - recv_var = "blank"; + recv_var = Gogo::erroneous_name(); } *is_send = false; if (recv_var != "_") @@ -5502,7 +5502,7 @@ Parse::package_clause() if (name == "_") { error_at(this->location(), "invalid package name _"); - name = "blank"; + name = Gogo::erroneous_name(); } this->advance_token(); } diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 32f827dd316..a4a60706b7a 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -9269,7 +9269,11 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr, } else { - if (!ambig1.empty()) + if (Gogo::is_erroneous_name(name)) + { + // An error was already reported. + } + else if (!ambig1.empty()) error_at(location, "%qs is ambiguous via %qs and %qs", Gogo::message_name(name).c_str(), ambig1.c_str(), ambig2.c_str()); -- cgit v1.2.3 From 576b068aa681aa4abf3b65427238051bb3f3d587 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 29 Sep 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203010 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ea0f9f0a84b..c36e9e75d5d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130928 +20130929 -- cgit v1.2.3 From 42486c839e0f7ad59f2c2d6597c199b6d64d8cba Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 30 Sep 2013 00:16:46 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203022 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c36e9e75d5d..a73e821f453 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130929 +20130930 -- cgit v1.2.3 From 91844116db5d9467fe7182d5a10e4fe0059a7e68 Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Mon, 30 Sep 2013 17:42:52 +0000 Subject: 2013-09-30 Chris Jefferson PR libstdc++/58437 * include/bits/stl_algo.h (__move_median_first): Rename to __move_median_to_first, change to take an addition argument. (__unguarded_partition_pivot): Adjust. * testsuite/performance/25_algorithms/sort.cc: New. * testsuite/performance/25_algorithms/sort_heap.cc: Likewise. * testsuite/performance/25_algorithms/stable_sort.cc: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203036 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 10 +++ libstdc++-v3/include/bits/stl_algo.h | 41 +++++++----- .../testsuite/performance/25_algorithms/sort.cc | 65 +++++++++++++++++++ .../performance/25_algorithms/sort_heap.cc | 73 ++++++++++++++++++++++ .../performance/25_algorithms/stable_sort.cc | 65 +++++++++++++++++++ 5 files changed, 237 insertions(+), 17 deletions(-) create mode 100644 libstdc++-v3/testsuite/performance/25_algorithms/sort.cc create mode 100644 libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc create mode 100644 libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0cf38cab9f8..bd5f220c061 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2013-09-30 Chris Jefferson + + PR libstdc++/58437 + * include/bits/stl_algo.h (__move_median_first): Rename to + __move_median_to_first, change to take an addition argument. + (__unguarded_partition_pivot): Adjust. + * testsuite/performance/25_algorithms/sort.cc: New. + * testsuite/performance/25_algorithms/sort_heap.cc: Likewise. + * testsuite/performance/25_algorithms/stable_sort.cc: Likewise. + 2013-09-19 Mitsuru Kariya Chris Jefferson diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 631be020696..35b5fa6fb50 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -72,10 +72,11 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - /// Swaps the median value of *__a, *__b and *__c to *__a + /// Swaps the median value of *__a, *__b and *__c to *__result template void - __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c) + __move_median_to_first(_Iterator __result, _Iterator __a, + _Iterator __b, _Iterator __c) { // concept requirements __glibcxx_function_requires(_LessThanComparableConcept< @@ -84,23 +85,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (*__a < *__b) { if (*__b < *__c) - std::iter_swap(__a, __b); + std::iter_swap(__result, __b); else if (*__a < *__c) - std::iter_swap(__a, __c); + std::iter_swap(__result, __c); + else + std::iter_swap(__result, __a); } else if (*__a < *__c) - return; + std::iter_swap(__result, __a); else if (*__b < *__c) - std::iter_swap(__a, __c); + std::iter_swap(__result, __c); else - std::iter_swap(__a, __b); + std::iter_swap(__result, __b); } - /// Swaps the median value of *__a, *__b and *__c under __comp to *__a + /// Swaps the median value of *__a, *__b and *__c under __comp to *__result template void - __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c, - _Compare __comp) + __move_median_to_first(_Iterator __result, _Iterator __a, + _Iterator __b, _Iterator __c, + _Compare __comp) { // concept requirements __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool, @@ -110,16 +114,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__comp(*__a, *__b)) { if (__comp(*__b, *__c)) - std::iter_swap(__a, __b); + std::iter_swap(__result, __b); else if (__comp(*__a, *__c)) - std::iter_swap(__a, __c); + std::iter_swap(__result, __c); + else + std::iter_swap(__result, __a); } else if (__comp(*__a, *__c)) - return; + std::iter_swap(__result, __a); else if (__comp(*__b, *__c)) - std::iter_swap(__a, __c); + std::iter_swap(__result, __c); else - std::iter_swap(__a, __b); + std::iter_swap(__result, __b); } // for_each @@ -2273,7 +2279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RandomAccessIterator __last) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_first(__first, __mid, (__last - 1)); + std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2)); return std::__unguarded_partition(__first + 1, __last, *__first); } @@ -2285,7 +2291,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RandomAccessIterator __last, _Compare __comp) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_first(__first, __mid, (__last - 1), __comp); + std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2), + __comp); return std::__unguarded_partition(__first + 1, __last, *__first, __comp); } diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc b/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc new file mode 100644 index 00000000000..07062ab8b3f --- /dev/null +++ b/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc @@ -0,0 +1,65 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +int main() +{ + using namespace __gnu_test; + + time_counter time; + resource_counter resource; + + const int max_size = 10000000; + + std::vector v(max_size); + + for (int i = 0; i < max_size; ++i) + v[i] = -i; + + start_counters(time, resource); + std::sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "reverse", time, resource); + clear_counters(time, resource); + + for (int i = 0; i < max_size; ++i) + v[i] = i; + + start_counters(time, resource); + std::sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "forwards", time, resource); + clear_counters(time, resource); + + // a simple psuedo-random series which does not rely on rand() and friends + v[0] = 0; + for (int i = 1; i < max_size; ++i) + v[i] = (v[i-1] + 110211473) * 745988807; + + start_counters(time, resource); + std::sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "random", time, resource); + + return 0; +} diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc b/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc new file mode 100644 index 00000000000..63cb2248033 --- /dev/null +++ b/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc @@ -0,0 +1,73 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +int main() +{ + using namespace __gnu_test; + + time_counter time; + resource_counter resource; + + const int max_size = 10000000; + + std::vector v(max_size); + + for (int i = 0; i < max_size; ++i) + v[i] = -i; + + start_counters(time, resource); + std::make_heap(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "make_heap_reverse", time, resource); + clear_counters(time, resource); + + for (int i = 0; i < max_size; ++i) + v[i] = i; + + start_counters(time, resource); + std::make_heap(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "make_heap_forwards", time, resource); + clear_counters(time, resource); + + // a simple psuedo-random series which does not rely on rand() and friends + v[0] = 0; + for (int i = 1; i < max_size; ++i) + v[i] = (v[i-1] + 110211473) * 745988807; + + start_counters(time, resource); + std::make_heap(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "make_heap_random", time, resource); + + + start_counters(time, resource); + std::sort_heap(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "sort_heap", time, resource); + clear_counters(time, resource); + + return 0; +} diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc b/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc new file mode 100644 index 00000000000..6440eb35f8f --- /dev/null +++ b/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc @@ -0,0 +1,65 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +int main() +{ + using namespace __gnu_test; + + time_counter time; + resource_counter resource; + + const int max_size = 10000000; + + std::vector v(max_size); + + for (int i = 0; i < max_size; ++i) + v[i] = -i; + + start_counters(time, resource); + std::stable_sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "reverse", time, resource); + clear_counters(time, resource); + + for (int i = 0; i < max_size; ++i) + v[i] = i; + + start_counters(time, resource); + std::stable_sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "forwards", time, resource); + clear_counters(time, resource); + + // a simple psuedo-random series which does not rely on rand() and friends + v[0] = 0; + for (int i = 1; i < max_size; ++i) + v[i] = (v[i-1] + 110211473) * 745988807; + + start_counters(time, resource); + std::stable_sort(v.begin(), v.end()); + stop_counters(time, resource); + + report_performance(__FILE__, "random", time, resource); + + return 0; +} -- cgit v1.2.3 From 2ff3b06e1928ec82343e94d16a71b7b650353f60 Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Mon, 30 Sep 2013 18:12:24 +0000 Subject: compiler: Use backend interface for variable expressions. * go-gcc.cc (Backend::error_expression): New function. (Backend::var_expression): New function. (Backend::indirect_expression): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203039 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 6 ++++++ gcc/go/go-gcc.cc | 34 ++++++++++++++++++++++++++++++++++ gcc/go/gofrontend/backend.h | 16 ++++++++++++++++ gcc/go/gofrontend/expressions.cc | 13 +++++-------- 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 7edfb604686..93b312e3897 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2013-09-30 Chris Manghane + + * go-gcc.cc (Backend::error_expression): New function. + (Backend::var_expression): New function. + (Backend::indirect_expression): New function. + 2013-08-28 Ian Lance Taylor * go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 025bb2bdca0..df8c4fc6d94 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -208,6 +208,16 @@ class Gcc_backend : public Backend Bexpression* zero_expression(Btype*); + Bexpression* + error_expression() + { return this->make_expression(error_mark_node); } + + Bexpression* + var_expression(Bvariable* var, Location); + + Bexpression* + indirect_expression(Bexpression* expr, bool known_valid, Location); + // Statements. Bstatement* @@ -848,6 +858,30 @@ Gcc_backend::zero_expression(Btype* btype) return tree_to_expr(ret); } +// An expression that references a variable. + +Bexpression* +Gcc_backend::var_expression(Bvariable* var, Location) +{ + tree ret = var->get_tree(); + if (ret == error_mark_node) + return this->error_expression(); + return tree_to_expr(ret); +} + +// An expression that indirectly references an expression. + +Bexpression* +Gcc_backend::indirect_expression(Bexpression* expr, bool known_valid, + Location location) +{ + tree ret = build_fold_indirect_ref_loc(location.gcc_location(), + expr->get_tree()); + if (known_valid) + TREE_THIS_NOTRAP(ret) = 1; + return tree_to_expr(ret); +} + // An expression as a statement. Bstatement* diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index ac29b03e453..18a594736c4 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -231,6 +231,22 @@ class Backend virtual Bexpression* zero_expression(Btype*) = 0; + // Create an error expression. This is used for cases which should + // not occur in a correct program, in order to keep the compilation + // going without crashing. + virtual Bexpression* + error_expression() = 0; + + // Create a reference to a variable. + virtual Bexpression* + var_expression(Bvariable* var, Location) = 0; + + // Create an expression that indirects through the pointer expression EXPR + // (i.e., return the expression for *EXPR). KNOWN_VALID is true if the pointer + // is known to point to a valid memory location. + virtual Bexpression* + indirect_expression(Bexpression* expr, bool known_valid, Location) = 0; + // Statements. // Create an error statement. This is used for cases which should diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 99edb4b8031..430422c3876 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -978,22 +978,19 @@ Var_expression::do_get_tree(Translate_context* context) { Bvariable* bvar = this->variable_->get_backend_variable(context->gogo(), context->function()); - tree ret = var_to_tree(bvar); - if (ret == error_mark_node) - return error_mark_node; bool is_in_heap; + Location loc = this->location(); if (this->variable_->is_variable()) is_in_heap = this->variable_->var_value()->is_in_heap(); else if (this->variable_->is_result_variable()) is_in_heap = this->variable_->result_var_value()->is_in_heap(); else go_unreachable(); + + Bexpression* ret = context->backend()->var_expression(bvar, loc); if (is_in_heap) - { - ret = build_fold_indirect_ref_loc(this->location().gcc_location(), ret); - TREE_THIS_NOTRAP(ret) = 1; - } - return ret; + ret = context->backend()->indirect_expression(ret, true, loc); + return expr_to_tree(ret); } // Ast dump for variable expression. -- cgit v1.2.3 From 6ba52ffb593334c79e4d476ebfb6020219b6138b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 30 Sep 2013 20:16:14 +0000 Subject: PR middle-end/58564 * fold-const.c (fold_ternary_loc): For A < 0 : : 0 optimization, punt if sign_bit_p looked through any zero extension. * gcc.c-torture/execute/pr58564.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203043 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 19 +++++++++++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr58564.c | 14 ++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58564.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 611ed38dbdb..0da1c06561a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-09-30 Jakub Jelinek + + PR middle-end/58564 + * fold-const.c (fold_ternary_loc): For A < 0 : : 0 + optimization, punt if sign_bit_p looked through any zero extension. + 2013-09-27 Paulo Matos Backport from mainline. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3f59e307cbb..6dc8934f33b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -14085,14 +14085,29 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, && integer_zerop (op2) && (tem = sign_bit_p (TREE_OPERAND (arg0, 0), arg1))) { + /* sign_bit_p looks through both zero and sign extensions, + but for this optimization only sign extensions are + usable. */ + tree tem2 = TREE_OPERAND (arg0, 0); + while (tem != tem2) + { + if (TREE_CODE (tem2) != NOP_EXPR + || TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (tem2, 0)))) + { + tem = NULL_TREE; + break; + } + tem2 = TREE_OPERAND (tem2, 0); + } /* sign_bit_p only checks ARG1 bits within A's precision. If has wider type than A, bits outside of A's precision in need to be checked. If they are all 0, this optimization needs to be done in unsigned A's type, if they are all 1 in signed A's type, otherwise this can't be done. */ - if (TYPE_PRECISION (TREE_TYPE (tem)) - < TYPE_PRECISION (TREE_TYPE (arg1)) + if (tem + && TYPE_PRECISION (TREE_TYPE (tem)) + < TYPE_PRECISION (TREE_TYPE (arg1)) && TYPE_PRECISION (TREE_TYPE (tem)) < TYPE_PRECISION (type)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e35bf72c233..a19423d2c01 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-30 Jakub Jelinek + + PR middle-end/58564 + * gcc.c-torture/execute/pr58564.c: New test. + 2013-09-23 Eric Botcazou * gnat.dg/opt28.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58564.c b/gcc/testsuite/gcc.c-torture/execute/pr58564.c new file mode 100644 index 00000000000..967ee95d4ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58564.c @@ -0,0 +1,14 @@ +/* PR middle-end/58564 */ + +extern void abort (void); +int a, b; +short *c, **d = &c; + +int +main () +{ + b = (0, 0 > ((&c == d) & (1 && (a ^ 1)))) | 0U; + if (b != 0) + abort (); + return 0; +} -- cgit v1.2.3 From 3fad212fd33dd84024fc171daf79c60b150c0314 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 1 Oct 2013 00:16:42 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203050 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index a73e821f453..3eae4dd9329 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20130930 +20131001 -- cgit v1.2.3 From 55e1c0e531badbe863b9c602f81a7e4f53a314b5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 1 Oct 2013 03:12:30 +0000 Subject: reflect: Fix reflect.Call with function following non-pointer. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203053 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/reflect/all_test.go | 9 +++++++++ libgo/go/reflect/value.go | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go index 1fed58570f2..140a068b9ca 100644 --- a/libgo/go/reflect/all_test.go +++ b/libgo/go/reflect/all_test.go @@ -2406,6 +2406,15 @@ func TestVariadic(t *testing.T) { } } +func TestFuncArg(t *testing.T) { + f1 := func(i int, f func(int) int) int { return f(i) } + f2 := func(i int) int { return i + 1 } + r := ValueOf(f1).Call([]Value{ValueOf(100), ValueOf(f2)}) + if r[0].Int() != 101 { + t.Errorf("function returned %d, want 101", r[0].Int()) + } +} + var tagGetTests = []struct { Tag StructTag Key string diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go index 9901ed6a4c6..b199f70888c 100644 --- a/libgo/go/reflect/value.go +++ b/libgo/go/reflect/value.go @@ -433,7 +433,7 @@ func (v Value) call(op string, in []Value) []Value { if v.flag&flagMethod != 0 { nin++ } - firstPointer := len(in) > 0 && Kind(t.In(0).(*rtype).kind) != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ) + firstPointer := len(in) > 0 && t.In(0).Kind() != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ) params := make([]unsafe.Pointer, nin) off := 0 if v.flag&flagMethod != 0 { @@ -497,8 +497,10 @@ func isMethod(t *rtype) bool { sawRet := false for i, c := range s { if c == '(' { + if parens == 0 { + params++ + } parens++ - params++ } else if c == ')' { parens-- } else if parens == 0 && c == ' ' && s[i+1] != '(' && !sawRet { -- cgit v1.2.3 From 900ceb56a00a7b76473769196e52065be957e761 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 1 Oct 2013 13:50:30 +0000 Subject: PR target/58574 * config/s390/s390.c (s390_chunkify_start): Handle tablejump_p first, continue when done, for other jumps look through PARALLEL unconditionally. * gcc.c-torture/execute/pr58574.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203062 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 + gcc/config/s390/s390.c | 42 ++--- gcc/testsuite/ChangeLog | 5 + gcc/testsuite/gcc.c-torture/execute/pr58574.c | 219 ++++++++++++++++++++++++++ 4 files changed, 254 insertions(+), 20 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58574.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0da1c06561a..ff1d2f7e956 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-10-01 Jakub Jelinek + Andreas Krebbel + + PR target/58574 + * config/s390/s390.c (s390_chunkify_start): Handle tablejump_p first, + continue when done, for other jumps look through PARALLEL + unconditionally. + 2013-09-30 Jakub Jelinek PR middle-end/58564 diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 43db96c934b..7b40bc1476b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7064,25 +7064,12 @@ s390_chunkify_start (void) or a casesi jump, check all potential targets. */ else if (GET_CODE (insn) == JUMP_INSN) { - rtx pat = PATTERN (insn); - if (GET_CODE (pat) == PARALLEL && XVECLEN (pat, 0) > 2) - pat = XVECEXP (pat, 0, 0); - - if (GET_CODE (pat) == SET) - { - rtx label = JUMP_LABEL (insn); - if (label) - { - if (s390_find_pool (pool_list, label) - != s390_find_pool (pool_list, insn)) - bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label)); - } - } - else if (GET_CODE (pat) == PARALLEL - && XVECLEN (pat, 0) == 2 - && GET_CODE (XVECEXP (pat, 0, 0)) == SET - && GET_CODE (XVECEXP (pat, 0, 1)) == USE - && GET_CODE (XEXP (XVECEXP (pat, 0, 1), 0)) == LABEL_REF) + rtx pat = PATTERN (insn); + if (GET_CODE (pat) == PARALLEL + && XVECLEN (pat, 0) == 2 + && GET_CODE (XVECEXP (pat, 0, 0)) == SET + && GET_CODE (XVECEXP (pat, 0, 1)) == USE + && GET_CODE (XEXP (XVECEXP (pat, 0, 1), 0)) == LABEL_REF) { /* Find the jump table used by this casesi jump. */ rtx vec_label = XEXP (XEXP (XVECEXP (pat, 0, 1), 0), 0); @@ -7104,8 +7091,23 @@ s390_chunkify_start (void) bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label)); } } + continue; } - } + + if (GET_CODE (pat) == PARALLEL) + pat = XVECEXP (pat, 0, 0); + + if (GET_CODE (pat) == SET) + { + rtx label = JUMP_LABEL (insn); + if (label) + { + if (s390_find_pool (pool_list, label) + != s390_find_pool (pool_list, insn)) + bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label)); + } + } + } } /* Insert base register reload insns before every pool. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a19423d2c01..7df077da136 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-01 Jakub Jelinek + + PR target/58574 + * gcc.c-torture/execute/pr58574.c: New test. + 2013-09-30 Jakub Jelinek PR middle-end/58564 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58574.c b/gcc/testsuite/gcc.c-torture/execute/pr58574.c new file mode 100644 index 00000000000..44827eb7819 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58574.c @@ -0,0 +1,219 @@ +/* PR target/58574 */ + +__attribute__((noinline, noclone)) double +foo (double x) +{ + double t; + switch ((int) x) + { + case 0: + t = 2 * x - 1; + return 0.70878e-3 + (0.71234e-3 + (0.35779e-5 + (0.17403e-7 + (0.81710e-10 + (0.36885e-12 + 0.15917e-14 * t) * t) * t) * t) * t) * t; + case 1: + t = 2 * x - 3; + return 0.21479e-2 + (0.72686e-3 + (0.36843e-5 + (0.18071e-7 + (0.85496e-10 + (0.38852e-12 + 0.16868e-14 * t) * t) * t) * t) * t) * t; + case 2: + t = 2 * x - 5; + return 0.36165e-2 + (0.74182e-3 + (0.37948e-5 + (0.18771e-7 + (0.89484e-10 + (0.40935e-12 + 0.17872e-14 * t) * t) * t) * t) * t) * t; + case 3: + t = 2 * x - 7; + return 0.51154e-2 + (0.75722e-3 + (0.39096e-5 + (0.19504e-7 + (0.93687e-10 + (0.43143e-12 + 0.18939e-14 * t) * t) * t) * t) * t) * t; + case 4: + t = 2 * x - 9; + return 0.66457e-2 + (0.77310e-3 + (0.40289e-5 + (0.20271e-7 + (0.98117e-10 + (0.45484e-12 + 0.20076e-14 * t) * t) * t) * t) * t) * t; + case 5: + t = 2 * x - 11; + return 0.82082e-2 + (0.78946e-3 + (0.41529e-5 + (0.21074e-7 + (0.10278e-9 + (0.47965e-12 + 0.21285e-14 * t) * t) * t) * t) * t) * t; + case 6: + t = 2 * x - 13; + return 0.98039e-2 + (0.80633e-3 + (0.42819e-5 + (0.21916e-7 + (0.10771e-9 + (0.50595e-12 + 0.22573e-14 * t) * t) * t) * t) * t) * t; + case 7: + t = 2 * x - 15; + return 0.11433e-1 + (0.82372e-3 + (0.44160e-5 + (0.22798e-7 + (0.11291e-9 + (0.53386e-12 + 0.23944e-14 * t) * t) * t) * t) * t) * t; + case 8: + t = 2 * x - 17; + return 0.13099e-1 + (0.84167e-3 + (0.45555e-5 + (0.23723e-7 + (0.11839e-9 + (0.56346e-12 + 0.25403e-14 * t) * t) * t) * t) * t) * t; + case 9: + t = 2 * x - 19; + return 0.14800e-1 + (0.86018e-3 + (0.47008e-5 + (0.24694e-7 + (0.12418e-9 + (0.59486e-12 + 0.26957e-14 * t) * t) * t) * t) * t) * t; + case 10: + t = 2 * x - 21; + return 0.16540e-1 + (0.87928e-3 + (0.48520e-5 + (0.25711e-7 + (0.13030e-9 + (0.62820e-12 + 0.28612e-14 * t) * t) * t) * t) * t) * t; + case 11: + t = 2 * x - 23; + return 0.18318e-1 + (0.89900e-3 + (0.50094e-5 + (0.26779e-7 + (0.13675e-9 + (0.66358e-12 + 0.30375e-14 * t) * t) * t) * t) * t) * t; + case 12: + t = 2 * x - 25; + return 0.20136e-1 + (0.91936e-3 + (0.51734e-5 + (0.27900e-7 + (0.14357e-9 + (0.70114e-12 + 0.32252e-14 * t) * t) * t) * t) * t) * t; + case 13: + t = 2 * x - 27; + return 0.21996e-1 + (0.94040e-3 + (0.53443e-5 + (0.29078e-7 + (0.15078e-9 + (0.74103e-12 + 0.34251e-14 * t) * t) * t) * t) * t) * t; + case 14: + t = 2 * x - 29; + return 0.23898e-1 + (0.96213e-3 + (0.55225e-5 + (0.30314e-7 + (0.15840e-9 + (0.78340e-12 + 0.36381e-14 * t) * t) * t) * t) * t) * t; + case 15: + t = 2 * x - 31; + return 0.25845e-1 + (0.98459e-3 + (0.57082e-5 + (0.31613e-7 + (0.16646e-9 + (0.82840e-12 + 0.38649e-14 * t) * t) * t) * t) * t) * t; + case 16: + t = 2 * x - 33; + return 0.27837e-1 + (0.10078e-2 + (0.59020e-5 + (0.32979e-7 + (0.17498e-9 + (0.87622e-12 + 0.41066e-14 * t) * t) * t) * t) * t) * t; + case 17: + t = 2 * x - 35; + return 0.29877e-1 + (0.10318e-2 + (0.61041e-5 + (0.34414e-7 + (0.18399e-9 + (0.92703e-12 + 0.43639e-14 * t) * t) * t) * t) * t) * t; + case 18: + t = 2 * x - 37; + return 0.31965e-1 + (0.10566e-2 + (0.63151e-5 + (0.35924e-7 + (0.19353e-9 + (0.98102e-12 + 0.46381e-14 * t) * t) * t) * t) * t) * t; + case 19: + t = 2 * x - 39; + return 0.34104e-1 + (0.10823e-2 + (0.65354e-5 + (0.37512e-7 + (0.20362e-9 + (0.10384e-11 + 0.49300e-14 * t) * t) * t) * t) * t) * t; + case 20: + t = 2 * x - 41; + return 0.36295e-1 + (0.11089e-2 + (0.67654e-5 + (0.39184e-7 + (0.21431e-9 + (0.10994e-11 + 0.52409e-14 * t) * t) * t) * t) * t) * t; + case 21: + t = 2 * x - 43; + return 0.38540e-1 + (0.11364e-2 + (0.70058e-5 + (0.40943e-7 + (0.22563e-9 + (0.11642e-11 + 0.55721e-14 * t) * t) * t) * t) * t) * t; + case 22: + t = 2 * x - 45; + return 0.40842e-1 + (0.11650e-2 + (0.72569e-5 + (0.42796e-7 + (0.23761e-9 + (0.12332e-11 + 0.59246e-14 * t) * t) * t) * t) * t) * t; + case 23: + t = 2 * x - 47; + return 0.43201e-1 + (0.11945e-2 + (0.75195e-5 + (0.44747e-7 + (0.25030e-9 + (0.13065e-11 + 0.63000e-14 * t) * t) * t) * t) * t) * t; + case 24: + t = 2 * x - 49; + return 0.45621e-1 + (0.12251e-2 + (0.77941e-5 + (0.46803e-7 + (0.26375e-9 + (0.13845e-11 + 0.66996e-14 * t) * t) * t) * t) * t) * t; + case 25: + t = 2 * x - 51; + return 0.48103e-1 + (0.12569e-2 + (0.80814e-5 + (0.48969e-7 + (0.27801e-9 + (0.14674e-11 + 0.71249e-14 * t) * t) * t) * t) * t) * t; + case 26: + t = 2 * x - 59; + return 0.58702e-1 + (0.13962e-2 + (0.93714e-5 + (0.58882e-7 + (0.34414e-9 + (0.18552e-11 + 0.91160e-14 * t) * t) * t) * t) * t) * t; + case 30: + t = 2 * x - 79; + return 0.90908e-1 + (0.18544e-2 + (0.13903e-4 + (0.95549e-7 + (0.59752e-9 + (0.33656e-11 + 0.16815e-13 * t) * t) * t) * t) * t) * t; + case 40: + t = 2 * x - 99; + return 0.13443e0 + (0.25474e-2 + (0.21385e-4 + (0.15996e-6 + (0.10585e-8 + (0.61258e-11 + 0.30412e-13 * t) * t) * t) * t) * t) * t; + case 50: + t = 2 * x - 119; + return 0.19540e0 + (0.36342e-2 + (0.34096e-4 + (0.27479e-6 + (0.18934e-8 + (0.11021e-10 + 0.52931e-13 * t) * t) * t) * t) * t) * t; + case 60: + t = 2 * x - 121; + return 0.20281e0 + (0.37739e-2 + (0.35791e-4 + (0.29038e-6 + (0.20068e-8 + (0.11673e-10 + 0.55790e-13 * t) * t) * t) * t) * t) * t; + case 61: + t = 2 * x - 123; + return 0.21050e0 + (0.39206e-2 + (0.37582e-4 + (0.30691e-6 + (0.21270e-8 + (0.12361e-10 + 0.58770e-13 * t) * t) * t) * t) * t) * t; + case 62: + t = 2 * x - 125; + return 0.21849e0 + (0.40747e-2 + (0.39476e-4 + (0.32443e-6 + (0.22542e-8 + (0.13084e-10 + 0.61873e-13 * t) * t) * t) * t) * t) * t; + case 63: + t = 2 * x - 127; + return 0.22680e0 + (0.42366e-2 + (0.41477e-4 + (0.34300e-6 + (0.23888e-8 + (0.13846e-10 + 0.65100e-13 * t) * t) * t) * t) * t) * t; + case 64: + t = 2 * x - 129; + return 0.23545e0 + (0.44067e-2 + (0.43594e-4 + (0.36268e-6 + (0.25312e-8 + (0.14647e-10 + 0.68453e-13 * t) * t) * t) * t) * t) * t; + case 65: + t = 2 * x - 131; + return 0.24444e0 + (0.45855e-2 + (0.45832e-4 + (0.38352e-6 + (0.26819e-8 + (0.15489e-10 + 0.71933e-13 * t) * t) * t) * t) * t) * t; + case 66: + t = 2 * x - 133; + return 0.25379e0 + (0.47735e-2 + (0.48199e-4 + (0.40561e-6 + (0.28411e-8 + (0.16374e-10 + 0.75541e-13 * t) * t) * t) * t) * t) * t; + case 67: + t = 2 * x - 135; + return 0.26354e0 + (0.49713e-2 + (0.50702e-4 + (0.42901e-6 + (0.30095e-8 + (0.17303e-10 + 0.79278e-13 * t) * t) * t) * t) * t) * t; + case 68: + t = 2 * x - 137; + return 0.27369e0 + (0.51793e-2 + (0.53350e-4 + (0.45379e-6 + (0.31874e-8 + (0.18277e-10 + 0.83144e-13 * t) * t) * t) * t) * t) * t; + case 69: + t = 2 * x - 139; + return 0.28426e0 + (0.53983e-2 + (0.56150e-4 + (0.48003e-6 + (0.33752e-8 + (0.19299e-10 + 0.87139e-13 * t) * t) * t) * t) * t) * t; + case 70: + t = 2 * x - 141; + return 0.29529e0 + (0.56288e-2 + (0.59113e-4 + (0.50782e-6 + (0.35735e-8 + (0.20369e-10 + 0.91262e-13 * t) * t) * t) * t) * t) * t; + case 71: + t = 2 * x - 143; + return 0.30679e0 + (0.58714e-2 + (0.62248e-4 + (0.53724e-6 + (0.37827e-8 + (0.21490e-10 + 0.95513e-13 * t) * t) * t) * t) * t) * t; + case 72: + t = 2 * x - 145; + return 0.31878e0 + (0.61270e-2 + (0.65564e-4 + (0.56837e-6 + (0.40035e-8 + (0.22662e-10 + 0.99891e-13 * t) * t) * t) * t) * t) * t; + case 73: + t = 2 * x - 147; + return 0.33130e0 + (0.63962e-2 + (0.69072e-4 + (0.60133e-6 + (0.42362e-8 + (0.23888e-10 + 0.10439e-12 * t) * t) * t) * t) * t) * t; + case 74: + t = 2 * x - 149; + return 0.34438e0 + (0.66798e-2 + (0.72783e-4 + (0.63619e-6 + (0.44814e-8 + (0.25168e-10 + 0.10901e-12 * t) * t) * t) * t) * t) * t; + case 75: + t = 2 * x - 151; + return 0.35803e0 + (0.69787e-2 + (0.76710e-4 + (0.67306e-6 + (0.47397e-8 + (0.26505e-10 + 0.11376e-12 * t) * t) * t) * t) * t) * t; + case 76: + t = 2 * x - 153; + return 0.37230e0 + (0.72938e-2 + (0.80864e-4 + (0.71206e-6 + (0.50117e-8 + (0.27899e-10 + 0.11862e-12 * t) * t) * t) * t) * t) * t; + case 77: + t = 2 * x - 155; + return 0.38722e0 + (0.76260e-2 + (0.85259e-4 + (0.75329e-6 + (0.52979e-8 + (0.29352e-10 + 0.12360e-12 * t) * t) * t) * t) * t) * t; + case 78: + t = 2 * x - 157; + return 0.40282e0 + (0.79762e-2 + (0.89909e-4 + (0.79687e-6 + (0.55989e-8 + (0.30866e-10 + 0.12868e-12 * t) * t) * t) * t) * t) * t; + case 79: + t = 2 * x - 159; + return 0.41914e0 + (0.83456e-2 + (0.94827e-4 + (0.84291e-6 + (0.59154e-8 + (0.32441e-10 + 0.13387e-12 * t) * t) * t) * t) * t) * t; + case 80: + t = 2 * x - 161; + return 0.43621e0 + (0.87352e-2 + (0.10002e-3 + (0.89156e-6 + (0.62480e-8 + (0.34079e-10 + 0.13917e-12 * t) * t) * t) * t) * t) * t; + case 81: + t = 2 * x - 163; + return 0.45409e0 + (0.91463e-2 + (0.10553e-3 + (0.94293e-6 + (0.65972e-8 + (0.35782e-10 + 0.14455e-12 * t) * t) * t) * t) * t) * t; + case 82: + t = 2 * x - 165; + return 0.47282e0 + (0.95799e-2 + (0.11135e-3 + (0.99716e-6 + (0.69638e-8 + (0.37549e-10 + 0.15003e-12 * t) * t) * t) * t) * t) * t; + case 83: + t = 2 * x - 167; + return 0.49243e0 + (0.10037e-1 + (0.11750e-3 + (0.10544e-5 + (0.73484e-8 + (0.39383e-10 + 0.15559e-12 * t) * t) * t) * t) * t) * t; + case 84: + t = 2 * x - 169; + return 0.51298e0 + (0.10520e-1 + (0.12400e-3 + (0.11147e-5 + (0.77517e-8 + (0.41283e-10 + 0.16122e-12 * t) * t) * t) * t) * t) * t; + case 85: + t = 2 * x - 171; + return 0.53453e0 + (0.11030e-1 + (0.13088e-3 + (0.11784e-5 + (0.81743e-8 + (0.43252e-10 + 0.16692e-12 * t) * t) * t) * t) * t) * t; + case 86: + t = 2 * x - 173; + return 0.55712e0 + (0.11568e-1 + (0.13815e-3 + (0.12456e-5 + (0.86169e-8 + (0.45290e-10 + 0.17268e-12 * t) * t) * t) * t) * t) * t; + case 87: + t = 2 * x - 175; + return 0.58082e0 + (0.12135e-1 + (0.14584e-3 + (0.13164e-5 + (0.90803e-8 + (0.47397e-10 + 0.17850e-12 * t) * t) * t) * t) * t) * t; + case 88: + t = 2 * x - 177; + return 0.60569e0 + (0.12735e-1 + (0.15396e-3 + (0.13909e-5 + (0.95651e-8 + (0.49574e-10 + 0.18435e-12 * t) * t) * t) * t) * t) * t; + case 89: + t = 2 * x - 179; + return 0.63178e0 + (0.13368e-1 + (0.16254e-3 + (0.14695e-5 + (0.10072e-7 + (0.51822e-10 + 0.19025e-12 * t) * t) * t) * t) * t) * t; + case 90: + t = 2 * x - 181; + return 0.65918e0 + (0.14036e-1 + (0.17160e-3 + (0.15521e-5 + (0.10601e-7 + (0.54140e-10 + 0.19616e-12 * t) * t) * t) * t) * t) * t; + case 91: + t = 2 * x - 183; + return 0.68795e0 + (0.14741e-1 + (0.18117e-3 + (0.16392e-5 + (0.11155e-7 + (0.56530e-10 + 0.20209e-12 * t) * t) * t) * t) * t) * t; + case 92: + t = 2 * x - 185; + return 0.71818e0 + (0.15486e-1 + (0.19128e-3 + (0.17307e-5 + (0.11732e-7 + (0.58991e-10 + 0.20803e-12 * t) * t) * t) * t) * t) * t; + case 93: + t = 2 * x - 187; + return 0.74993e0 + (0.16272e-1 + (0.20195e-3 + (0.18269e-5 + (0.12335e-7 + (0.61523e-10 + 0.21395e-12 * t) * t) * t) * t) * t) * t; + } + return 1.0; +} + +int +main () +{ +#ifdef __s390x__ + { + register unsigned long r5 __asm ("r5"); + r5 = 0xdeadbeefUL; + asm volatile ("":"+r" (r5)); + } +#endif + double d = foo (78.4); + if (d < 0.38 || d > 0.42) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 1469d32d90716008410bfbc92a741927b14f5354 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 2 Oct 2013 00:16:46 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3eae4dd9329..f208a685f7d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131001 +20131002 -- cgit v1.2.3 From 44e8ba90a3d0ed9066edb6074ec59766c1e2c2e6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 2 Oct 2013 17:32:00 +0000 Subject: reflect: Use hand-coded .eh_frame section rather than CFI directives. From Rainer Orth. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203121 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/config.h.in | 12 ++++ libgo/configure | 95 +++++++++++++++++++++++++++++++ libgo/configure.ac | 62 ++++++++++++++++++++ libgo/go/reflect/makefunc_386.S | 116 +++++++++++++++++++++++++++++++++----- libgo/go/reflect/makefunc_amd64.S | 67 ++++++++++++++++++++-- 5 files changed, 331 insertions(+), 21 deletions(-) diff --git a/libgo/config.h.in b/libgo/config.h.in index 349ace6a2ad..1057d9e85e4 100644 --- a/libgo/config.h.in +++ b/libgo/config.h.in @@ -3,6 +3,9 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* Define to the flags needed for the .section .eh_frame directive. */ +#undef EH_FRAME_FLAGS + /* Define to 1 if you have the `accept4' function. */ #undef HAVE_ACCEPT4 @@ -12,6 +15,15 @@ /* Define to 1 if you have the `asinl' function. */ #undef HAVE_ASINL +/* Define if your assembler supports GNU comdat group syntax. */ +#undef HAVE_AS_COMDAT_GAS + +/* Define if your assembler supports unwind section type. */ +#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + +/* Define if your assembler supports PC relative relocs. */ +#undef HAVE_AS_X86_PCREL + /* Define to 1 if you have the `atan2l' function. */ #undef HAVE_ATAN2L diff --git a/libgo/configure b/libgo/configure index 06be5fd67a2..e54a2cd1b0c 100755 --- a/libgo/configure +++ b/libgo/configure @@ -15173,6 +15173,101 @@ $as_echo "#define SETCONTEXT_CLOBBERS_TLS 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 +$as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } +if test "${libgo_cv_ro_eh_frame+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +libgo_cv_ro_eh_frame=no +echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c +if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then + if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then + libgo_cv_ro_eh_frame=yes + elif grep '.section.*eh_frame.*#alloc' conftest.c \ + | grep -v '#write' > /dev/null; then + libgo_cv_ro_eh_frame=yes + fi +fi +rm -f conftest.* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_ro_eh_frame" >&5 +$as_echo "$libgo_cv_ro_eh_frame" >&6; } +if test "x$libgo_cv_ro_eh_frame" = xyes; then + +$as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h + +else + +$as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if assembler supports GNU comdat group syntax" >&5 +$as_echo_n "checking if assembler supports GNU comdat group syntax... " >&6; } +if test "${libgo_cv_as_comdat_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s +if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then + libgo_cv_as_comdat_gnu=yes +else + libgo_cv_as_comdat_gnu=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_comdat_gnu" >&5 +$as_echo "$libgo_cv_as_comdat_gnu" >&6; } +if test "x$libgo_cv_as_comdat_gnu" = xyes; then + +$as_echo "#define HAVE_AS_COMDAT_GAS 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 +$as_echo_n "checking assembler supports pc related relocs... " >&6; } +if test "${libgo_cv_as_x86_pcrel+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +libgo_cv_as_x86_pcrel=yes +echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s +if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then + libgo_cv_as_x86_pcrel=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_x86_pcrel" >&5 +$as_echo "$libgo_cv_as_x86_pcrel" >&6; } +if test "x$libgo_cv_as_x86_pcrel" = xyes; then + +$as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 +$as_echo_n "checking assembler supports unwind section type... " >&6; } +if test "${libgo_cv_as_x86_64_unwind_section_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +libgo_cv_as_x86_64_unwind_section_type=yes +echo '.section .eh_frame,"a",@unwind' > conftest.s +if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libgo_cv_as_x86_64_unwind_section_type=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_x86_64_unwind_section_type" >&5 +$as_echo "$libgo_cv_as_x86_64_unwind_section_type" >&6; } +if test "x$libgo_cv_as_x86_64_unwind_section_type" = xyes; then + +$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h + +fi + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/libgo/configure.ac b/libgo/configure.ac index 91c1cdbbb60..81c0a88b0cd 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -757,6 +757,68 @@ if test "$libgo_cv_lib_setcontext_clobbers_tls" = "yes"; then [Define if setcontext clobbers TLS variables]) fi +AC_CACHE_CHECK([whether .eh_frame section should be read-only], +libgo_cv_ro_eh_frame, [ +libgo_cv_ro_eh_frame=no +echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c +if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then + if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then + libgo_cv_ro_eh_frame=yes + elif grep '.section.*eh_frame.*#alloc' conftest.c \ + | grep -v '#write' > /dev/null; then + libgo_cv_ro_eh_frame=yes + fi +fi +rm -f conftest.* +]) +if test "x$libgo_cv_ro_eh_frame" = xyes; then + AC_DEFINE(EH_FRAME_FLAGS, "a", + [Define to the flags needed for the .section .eh_frame directive.]) +else + AC_DEFINE(EH_FRAME_FLAGS, "aw", + [Define to the flags needed for the .section .eh_frame directive.]) +fi + +AC_CACHE_CHECK([if assembler supports GNU comdat group syntax], +libgo_cv_as_comdat_gnu, [ +echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s +if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then + libgo_cv_as_comdat_gnu=yes +else + libgo_cv_as_comdat_gnu=no +fi +]) +if test "x$libgo_cv_as_comdat_gnu" = xyes; then + AC_DEFINE(HAVE_AS_COMDAT_GAS, 1, + [Define if your assembler supports GNU comdat group syntax.]) +fi + +AC_CACHE_CHECK([assembler supports pc related relocs], +libgo_cv_as_x86_pcrel, [ +libgo_cv_as_x86_pcrel=yes +echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s +if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then + libgo_cv_as_x86_pcrel=no +fi +]) +if test "x$libgo_cv_as_x86_pcrel" = xyes; then + AC_DEFINE(HAVE_AS_X86_PCREL, 1, + [Define if your assembler supports PC relative relocs.]) +fi + +AC_CACHE_CHECK([assembler supports unwind section type], +libgo_cv_as_x86_64_unwind_section_type, [ +libgo_cv_as_x86_64_unwind_section_type=yes +echo '.section .eh_frame,"a",@unwind' > conftest.s +if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libgo_cv_as_x86_64_unwind_section_type=no +fi +]) +if test "x$libgo_cv_as_x86_64_unwind_section_type" = xyes; then + AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, + [Define if your assembler supports unwind section type.]) +fi + AC_CACHE_SAVE if test ${multilib} = yes; then diff --git a/libgo/go/reflect/makefunc_386.S b/libgo/go/reflect/makefunc_386.S index f2f2fbe1a95..fb49281e2e3 100644 --- a/libgo/go/reflect/makefunc_386.S +++ b/libgo/go/reflect/makefunc_386.S @@ -4,6 +4,8 @@ # MakeFunc 386 assembly code. +#include "config.h" + .global reflect.makeFuncStub #ifdef __ELF__ @@ -11,7 +13,7 @@ #endif reflect.makeFuncStub: - .cfi_startproc +.LFB1: # Go does not provide any equivalent to the regparm function # attribute, so on Go we do not need to worry about passing @@ -27,15 +29,12 @@ reflect.makeFuncStub: # } pushl %ebp - .cfi_def_cfa_offset 8 - .cfi_offset %ebp, -8 +.LCFI0: movl %esp, %ebp - .cfi_def_cfa_register %ebp - +.LCFI1: pushl %ebx # In case this is PIC. - subl $36, %esp # Enough for args and to align stack. - .cfi_offset %ebx, -12 +.LCFI2: #ifdef __PIC__ call __x86.get_pc_thunk.bx @@ -75,36 +74,123 @@ reflect.makeFuncStub: addl $36, %esp popl %ebx - .cfi_restore %ebx +.LCFI3: popl %ebp - .cfi_restore %ebp - .cfi_def_cfa %esp, 4 - +.LCFI4: ret - .cfi_endproc - +.LFE1: #ifdef __ELF__ .size reflect.makeFuncStub, . - reflect.makeFuncStub #endif #ifdef __PIC__ +#ifdef HAVE_AS_COMDAT_GAS .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat +#else + /* Sun as needs a different syntax. */ + .section .text.__x86.get_pc_thunk.bx%__x86.get_pc_thunk.bx,"ax",@progbits + .group __x86.get_pc_thunk.bx,.text.__x86.get_pc_thunk.bx%__x86.get_pc_thunk.bx,#comdat +#endif .globl __x86.get_pc_thunk.bx .hidden __x86.get_pc_thunk.bx #ifdef __ELF__ .type __x86.get_pc_thunk.bx, @function #endif __x86.get_pc_thunk.bx: - .cfi_startproc +.LFB2: movl (%esp), %ebx ret - .cfi_endproc +.LFE2: #ifdef __ELF__ .size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx #endif #endif #ifdef __ELF__ +#if defined __PIC__ +# if defined __sun__ && defined __svr4__ +/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 + doesn't correctly sort .eh_frame_hdr with mixed encodings, so match this. */ +# define FDE_ENCODING 0x30 /* datarel */ +# define FDE_ENCODE(X) X@GOTOFF +# else +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# if defined HAVE_AS_X86_PCREL +# define FDE_ENCODE(X) X-. +# else +# define FDE_ENCODE(X) X@rel +# endif +# endif +#else +# define FDE_ENCODING 0 /* absolute */ +# define FDE_ENCODE(X) X +#endif + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ + .ascii "zR\0" /* CIE Augmentation */ + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte FDE_ENCODING + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ + .long FDE_ENCODE(.LFB1) /* FDE initial location */ + .long .LFE1-.LFB1 /* FDE address range */ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI2-.LCFI1 + .byte 0x83 /* .DW_CFA_offset, column 0x3 */ + .byte 0x3 /* .uleb128 0x3 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI3-.LCFI2 + .byte 0xc3 /* DW_CFA_restore, column 0x3 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LCFI3 + .byte 0xc5 /* DW_CFA_restore, column 0x5 */ + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .align 4 +.LEFDE1: +#ifdef __PIC__ +.LSFDE2: + .long .LEFDE2-.LASFDE2 /* FDE Length */ +.LASFDE2: + .long .LASFDE2-.Lframe1 /* FDE CIE offset */ + .long FDE_ENCODE(.LFB2) /* FDE initial location */ + .long .LFE2-.LFB2 /* FDE address range */ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ + .align 4 +.LEFDE2: +#endif /* __PIC__ */ +#endif /* __ELF__ */ + +#if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"",@progbits .section .note.GNU-split-stack,"",@progbits .section .note.GNU-no-split-stack,"",@progbits diff --git a/libgo/go/reflect/makefunc_amd64.S b/libgo/go/reflect/makefunc_amd64.S index 319aa18505c..9d12f193f01 100644 --- a/libgo/go/reflect/makefunc_amd64.S +++ b/libgo/go/reflect/makefunc_amd64.S @@ -4,6 +4,8 @@ # MakeFunc amd64 assembly code. +#include "config.h" + .global reflect.makeFuncStub #ifdef __ELF__ @@ -11,7 +13,7 @@ #endif reflect.makeFuncStub: - .cfi_startproc +.LFB1: # Store all the parameter registers in a struct that looks # like: @@ -35,10 +37,9 @@ reflect.makeFuncStub: # }; pushq %rbp - .cfi_def_cfa_offset 16 - .cfi_offset %rbp, -16 +.LCFI0: movq %rsp, %rbp - .cfi_def_cfa_register %rbp +.LCFI1: subq $0xc0, %rsp # Space for struct on stack. @@ -91,16 +92,70 @@ reflect.makeFuncStub: # double type. leave - .cfi_def_cfa %rsp, 8 +.LCFI2: ret +.LFE1: - .cfi_endproc #ifdef __ELF__ .size reflect.makeFuncStub, . - reflect.makeFuncStub #endif #ifdef __ELF__ +#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + .section .eh_frame,"a",@unwind +#else + .section .eh_frame,"a",@progbits +#endif +.Lframe1: + .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ + .ascii "zR\0" /* CIE Augmentation */ + .uleb128 1 /* CIE Code Alignment Factor */ + .sleb128 -8 /* CIE Data Alignment Factor */ + .byte 0x10 /* CIE RA Column */ + .uleb128 1 /* Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ + .uleb128 7 + .uleb128 8 + .byte 0x80+16 /* DW_CFA_offset, %rip offset 1*-8 */ + .uleb128 1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if HAVE_AS_X86_PCREL + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1@rel +#endif + .long .LFE1-.LFB1 /* FDE address range */ + .uleb128 0x0 /* Augmentation size */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .uleb128 16 + .byte 0x86 /* DW_CFA_offset, column 0x6 */ + .uleb128 2 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register */ + .uleb128 6 + .byte 0x2 /* DW_CFA_advance_loc1 */ + .byte .LCFI2-.LCFI1 + .byte 0xc /* DW_CFA_def_cfa */ + .uleb128 7 + .uleb128 8 + .align 8 +.LEFDE1: +#endif /* __ELF__ */ + +#if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"",@progbits .section .note.GNU-split-stack,"",@progbits .section .note.GNU-no-split-stack,"",@progbits -- cgit v1.2.3 From 1cf740952ce27491988c2b9a894c4f553bf4fcee Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 2 Oct 2013 18:27:30 +0000 Subject: /cp 2013-10-02 Paolo Carlini PR c++/58535 * parser.c (cp_parser_function_specifier_opt): Upon error about virtual templates don't set ds_virtual. /testsuite 2013-10-02 Paolo Carlini PR c++/58535 * g++.dg/parse/crash62.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203124 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/crash62.C | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/crash62.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 377376f4add..55d0408a80b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-02 Paolo Carlini + + PR c++/58535 + * parser.c (cp_parser_function_specifier_opt): Upon error about + virtual templates don't set ds_virtual. + 2013-09-18 Paolo Carlini PR c++/58457 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 8798fb3ea9a..b6322788fae 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11139,7 +11139,8 @@ cp_parser_function_specifier_opt (cp_parser* parser, A member function template shall not be virtual. */ if (PROCESSING_REAL_TEMPLATE_DECL_P ()) error_at (token->location, "templates may not be %"); - set_and_check_decl_spec_loc (decl_specs, ds_virtual, token); + else + set_and_check_decl_spec_loc (decl_specs, ds_virtual, token); break; case RID_EXPLICIT: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7df077da136..f562af9eac7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-02 Paolo Carlini + + PR c++/58535 + * g++.dg/parse/crash62.C: New. + 2013-10-01 Jakub Jelinek PR target/58574 diff --git a/gcc/testsuite/g++.dg/parse/crash62.C b/gcc/testsuite/g++.dg/parse/crash62.C new file mode 100644 index 00000000000..04154f40cd5 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash62.C @@ -0,0 +1,6 @@ +// PR c++/58535 + +struct A +{ + template virtual void foo(); // { dg-error "templates" } +}; -- cgit v1.2.3 From 1c1226fb7af2722ddc6a0486ac1c85f44c7b41e0 Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Wed, 2 Oct 2013 19:22:30 +0000 Subject: compiler: Use backend interface for numeric expressions. * go-gcc.cc: Include "real.h" and "realmpfr.h". (Backend::integer_constant_expression): New function. (Backend::float_constant_expression): New function. (Backend::complex_constant_expression): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203128 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 7 ++ gcc/go/go-gcc.cc | 67 +++++++++++++ gcc/go/gofrontend/backend.h | 15 +++ gcc/go/gofrontend/expressions.cc | 200 ++++++++++++++++++--------------------- gcc/go/gofrontend/expressions.h | 15 +-- gcc/go/gofrontend/types.cc | 6 +- 6 files changed, 187 insertions(+), 123 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 93b312e3897..a0a62197464 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,10 @@ +2013-10-02 Chris Manghane + + * go-gcc.cc: Include "real.h" and "realmpfr.h". + (Backend::integer_constant_expression): New function. + (Backend::float_constant_expression): New function. + (Backend::complex_constant_expression): New function. + 2013-09-30 Chris Manghane * go-gcc.cc (Backend::error_expression): New function. diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index df8c4fc6d94..55b60ade21d 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -29,6 +29,8 @@ #include "gimple.h" #include "toplev.h" #include "output.h" +#include "real.h" +#include "realmpfr.h" #include "go-c.h" @@ -218,6 +220,15 @@ class Gcc_backend : public Backend Bexpression* indirect_expression(Bexpression* expr, bool known_valid, Location); + Bexpression* + integer_constant_expression(Btype* btype, mpz_t val); + + Bexpression* + float_constant_expression(Btype* btype, mpfr_t val); + + Bexpression* + complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag); + // Statements. Bstatement* @@ -882,6 +893,62 @@ Gcc_backend::indirect_expression(Bexpression* expr, bool known_valid, return tree_to_expr(ret); } +// Return a typed value as a constant integer. + +Bexpression* +Gcc_backend::integer_constant_expression(Btype* btype, mpz_t val) +{ + tree t = btype->get_tree(); + if (t == error_mark_node) + return this->error_expression(); + + tree ret = double_int_to_tree(t, mpz_get_double_int(t, val, true)); + return tree_to_expr(ret); +} + +// Return a typed value as a constant floating-point number. + +Bexpression* +Gcc_backend::float_constant_expression(Btype* btype, mpfr_t val) +{ + tree t = btype->get_tree(); + tree ret; + if (t == error_mark_node) + return this->error_expression(); + + REAL_VALUE_TYPE r1; + real_from_mpfr(&r1, val, t, GMP_RNDN); + REAL_VALUE_TYPE r2; + real_convert(&r2, TYPE_MODE(t), &r1); + ret = build_real(t, r2); + return tree_to_expr(ret); +} + +// Return a typed real and imaginary value as a constant complex number. + +Bexpression* +Gcc_backend::complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag) +{ + tree t = btype->get_tree(); + tree ret; + if (t == error_mark_node) + return this->error_expression(); + + REAL_VALUE_TYPE r1; + real_from_mpfr(&r1, real, TREE_TYPE(t), GMP_RNDN); + REAL_VALUE_TYPE r2; + real_convert(&r2, TYPE_MODE(TREE_TYPE(t)), &r1); + + REAL_VALUE_TYPE r3; + real_from_mpfr(&r3, imag, TREE_TYPE(t), GMP_RNDN); + REAL_VALUE_TYPE r4; + real_convert(&r4, TYPE_MODE(TREE_TYPE(t)), &r3); + + ret = build_complex(t, build_real(TREE_TYPE(t), r2), + build_real(TREE_TYPE(t), r4)); + return tree_to_expr(ret); +} + // An expression as a statement. Bstatement* diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index 18a594736c4..d0abdd7f798 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -7,6 +7,9 @@ #ifndef GO_BACKEND_H #define GO_BACKEND_H +#include +#include + // Pointers to these types are created by the backend, passed to the // frontend, and passed back to the backend. The types must be // defined by the backend using these names. @@ -247,6 +250,18 @@ class Backend virtual Bexpression* indirect_expression(Bexpression* expr, bool known_valid, Location) = 0; + // Return an expression for the multi-precision integer VAL in BTYPE. + virtual Bexpression* + integer_constant_expression(Btype* btype, mpz_t val) = 0; + + // Return an expression for the floating point value VAL in BTYPE. + virtual Bexpression* + float_constant_expression(Btype* btype, mpfr_t val) = 0; + + // Return an expression for the complex value REAL/IMAG in BTYPE. + virtual Bexpression* + complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag) = 0; + // Statements. // Create an error statement. This is used for cases which should diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 430422c3876..67bec710df5 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -610,102 +610,57 @@ Expression::get_tree(Translate_context* context) return this->do_get_tree(context); } -// Return a tree for VAL in TYPE. - -tree -Expression::integer_constant_tree(mpz_t val, tree type) +// Return a backend expression for VAL. +Bexpression* +Expression::backend_numeric_constant_expression(Translate_context* context, + Numeric_constant* val) { - if (type == error_mark_node) - return error_mark_node; - else if (TREE_CODE(type) == INTEGER_TYPE) - return double_int_to_tree(type, - mpz_get_double_int(type, val, true)); - else if (TREE_CODE(type) == REAL_TYPE) - { - mpfr_t fval; - mpfr_init_set_z(fval, val, GMP_RNDN); - tree ret = Expression::float_constant_tree(fval, type); - mpfr_clear(fval); - return ret; - } - else if (TREE_CODE(type) == COMPLEX_TYPE) - { - mpfr_t fval; - mpfr_init_set_z(fval, val, GMP_RNDN); - tree real = Expression::float_constant_tree(fval, TREE_TYPE(type)); - mpfr_clear(fval); - tree imag = build_real_from_int_cst(TREE_TYPE(type), - integer_zero_node); - return build_complex(type, real, imag); - } - else - go_unreachable(); -} - -// Return a tree for VAL in TYPE. + Gogo* gogo = context->gogo(); + Type* type = val->type(); + if (type == NULL) + return gogo->backend()->error_expression(); -tree -Expression::float_constant_tree(mpfr_t val, tree type) -{ - if (type == error_mark_node) - return error_mark_node; - else if (TREE_CODE(type) == INTEGER_TYPE) + Btype* btype = type->get_backend(gogo); + Bexpression* ret; + if (type->integer_type() != NULL) { mpz_t ival; - mpz_init(ival); - mpfr_get_z(ival, val, GMP_RNDN); - tree ret = Expression::integer_constant_tree(ival, type); + if (!val->to_int(&ival)) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } + ret = gogo->backend()->integer_constant_expression(btype, ival); mpz_clear(ival); - return ret; } - else if (TREE_CODE(type) == REAL_TYPE) + else if (type->float_type() != NULL) { - REAL_VALUE_TYPE r1; - real_from_mpfr(&r1, val, type, GMP_RNDN); - REAL_VALUE_TYPE r2; - real_convert(&r2, TYPE_MODE(type), &r1); - return build_real(type, r2); + mpfr_t fval; + if (!val->to_float(&fval)) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } + ret = gogo->backend()->float_constant_expression(btype, fval); + mpfr_clear(fval); } - else if (TREE_CODE(type) == COMPLEX_TYPE) + else if (type->complex_type() != NULL) { - REAL_VALUE_TYPE r1; - real_from_mpfr(&r1, val, TREE_TYPE(type), GMP_RNDN); - REAL_VALUE_TYPE r2; - real_convert(&r2, TYPE_MODE(TREE_TYPE(type)), &r1); - tree imag = build_real_from_int_cst(TREE_TYPE(type), - integer_zero_node); - return build_complex(type, build_real(TREE_TYPE(type), r2), imag); + mpfr_t real; + mpfr_t imag; + if (!val->to_complex(&real, &imag)) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } + ret = gogo->backend()->complex_constant_expression(btype, real, imag); + mpfr_clear(real); + mpfr_clear(imag); } else go_unreachable(); -} -// Return a tree for REAL/IMAG in TYPE. - -tree -Expression::complex_constant_tree(mpfr_t real, mpfr_t imag, tree type) -{ - if (type == error_mark_node) - return error_mark_node; - else if (TREE_CODE(type) == INTEGER_TYPE || TREE_CODE(type) == REAL_TYPE) - return Expression::float_constant_tree(real, type); - else if (TREE_CODE(type) == COMPLEX_TYPE) - { - REAL_VALUE_TYPE r1; - real_from_mpfr(&r1, real, TREE_TYPE(type), GMP_RNDN); - REAL_VALUE_TYPE r2; - real_convert(&r2, TYPE_MODE(TREE_TYPE(type)), &r1); - - REAL_VALUE_TYPE r3; - real_from_mpfr(&r3, imag, TREE_TYPE(type), GMP_RNDN); - REAL_VALUE_TYPE r4; - real_convert(&r4, TYPE_MODE(TREE_TYPE(type)), &r3); - - return build_complex(type, build_real(TREE_TYPE(type), r2), - build_real(TREE_TYPE(type), r4)); - } - else - go_unreachable(); + return ret; } // Return a tree which evaluates to true if VAL, of arbitrary integer @@ -1998,21 +1953,18 @@ Integer_expression::do_check_types(Gogo*) tree Integer_expression::do_get_tree(Translate_context* context) { - Gogo* gogo = context->gogo(); - tree type; + Type* resolved_type = NULL; if (this->type_ != NULL && !this->type_->is_abstract()) - type = type_to_tree(this->type_->get_backend(gogo)); + resolved_type = this->type_; else if (this->type_ != NULL && this->type_->float_type() != NULL) { // We are converting to an abstract floating point type. - Type* ftype = Type::lookup_float_type("float64"); - type = type_to_tree(ftype->get_backend(gogo)); + resolved_type = Type::lookup_float_type("float64"); } else if (this->type_ != NULL && this->type_->complex_type() != NULL) { // We are converting to an abstract complex type. - Type* ctype = Type::lookup_complex_type("complex128"); - type = type_to_tree(ctype->get_backend(gogo)); + resolved_type = Type::lookup_complex_type("complex128"); } else { @@ -2023,16 +1975,23 @@ Integer_expression::do_get_tree(Translate_context* context) int bits = mpz_sizeinbase(this->val_, 2); Type* int_type = Type::lookup_integer_type("int"); if (bits < int_type->integer_type()->bits()) - type = type_to_tree(int_type->get_backend(gogo)); + resolved_type = int_type; else if (bits < 64) - { - Type* t = Type::lookup_integer_type("int64"); - type = type_to_tree(t->get_backend(gogo)); - } + resolved_type = Type::lookup_integer_type("int64"); else - type = long_long_integer_type_node; + { + if (!saw_errors()) + error_at(this->location(), + "unknown type for large integer constant"); + Bexpression* ret = context->gogo()->backend()->error_expression(); + return expr_to_tree(ret); + } } - return Expression::integer_constant_tree(this->val_, type); + Numeric_constant nc; + nc.set_int(resolved_type, this->val_); + Bexpression* ret = + Expression::backend_numeric_constant_expression(context, &nc); + return expr_to_tree(ret); } // Write VAL to export data. @@ -2286,24 +2245,32 @@ Float_expression::do_check_types(Gogo*) tree Float_expression::do_get_tree(Translate_context* context) { - Gogo* gogo = context->gogo(); - tree type; + Type* resolved_type; if (this->type_ != NULL && !this->type_->is_abstract()) - type = type_to_tree(this->type_->get_backend(gogo)); + resolved_type = this->type_; else if (this->type_ != NULL && this->type_->integer_type() != NULL) { // We have an abstract integer type. We just hope for the best. - type = type_to_tree(Type::lookup_integer_type("int")->get_backend(gogo)); + resolved_type = Type::lookup_integer_type("int"); + } + else if (this->type_ != NULL && this->type_->complex_type() != NULL) + { + // We are converting to an abstract complex type. + resolved_type = Type::lookup_complex_type("complex128"); } else { // If we still have an abstract type here, then this is being // used in a constant expression which didn't get reduced. We // just use float64 and hope for the best. - Type* ft = Type::lookup_float_type("float64"); - type = type_to_tree(ft->get_backend(gogo)); + resolved_type = Type::lookup_float_type("float64"); } - return Expression::float_constant_tree(this->val_, type); + + Numeric_constant nc; + nc.set_float(resolved_type, this->val_); + Bexpression* ret = + Expression::backend_numeric_constant_expression(context, &nc); + return expr_to_tree(ret); } // Write a floating point number to a string dump. @@ -2463,19 +2430,32 @@ Complex_expression::do_check_types(Gogo*) tree Complex_expression::do_get_tree(Translate_context* context) { - Gogo* gogo = context->gogo(); - tree type; + Type* resolved_type; if (this->type_ != NULL && !this->type_->is_abstract()) - type = type_to_tree(this->type_->get_backend(gogo)); + resolved_type = this->type_; + else if (this->type_ != NULL && this->type_->integer_type() != NULL) + { + // We are converting to an abstract integer type. + resolved_type = Type::lookup_integer_type("int"); + } + else if (this->type_ != NULL && this->type_->float_type() != NULL) + { + // We are converting to an abstract float type. + resolved_type = Type::lookup_float_type("float64"); + } else { // If we still have an abstract type here, this this is being // used in a constant expression which didn't get reduced. We // just use complex128 and hope for the best. - Type* ct = Type::lookup_complex_type("complex128"); - type = type_to_tree(ct->get_backend(gogo)); + resolved_type = Type::lookup_complex_type("complex128"); } - return Expression::complex_constant_tree(this->real_, this->imag_, type); + + Numeric_constant nc; + nc.set_complex(resolved_type, this->real_, this->imag_); + Bexpression* ret = + Expression::backend_numeric_constant_expression(context, &nc); + return expr_to_tree(ret); } // Write REAL/IMAG to export data. diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 95584f2748b..b4cca5453b0 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -652,17 +652,10 @@ class Expression Type* left_type, tree left_tree, Type* right_type, tree right_tree, Location); - // Return a tree for the multi-precision integer VAL in TYPE. - static tree - integer_constant_tree(mpz_t val, tree type); - - // Return a tree for the floating point value VAL in TYPE. - static tree - float_constant_tree(mpfr_t val, tree type); - - // Return a tree for the complex value REAL/IMAG in TYPE. - static tree - complex_constant_tree(mpfr_t real, mpfr_t imag, tree type); + // Return the backend expression for the numeric constant VAL. + static Bexpression* + backend_numeric_constant_expression(Translate_context*, + Numeric_constant* val); // Export the expression. This is only used for constants. It will // be used for things like values of named constants and sizes of diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index a4a60706b7a..e1d68e74345 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -5665,8 +5665,10 @@ Array_type::get_length_tree(Gogo* gogo) t = Type::lookup_integer_type("int"); else if (t->is_abstract()) t = t->make_non_abstract_type(); - tree tt = type_to_tree(t->get_backend(gogo)); - this->length_tree_ = Expression::integer_constant_tree(val, tt); + Btype* btype = t->get_backend(gogo); + Bexpression* iexpr = + gogo->backend()->integer_constant_expression(btype, val); + this->length_tree_ = expr_to_tree(iexpr); mpz_clear(val); } else -- cgit v1.2.3 From ba2001ff2d7ab3ba8494ae1a3f624fc4f67a2c0a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 2 Oct 2013 20:22:02 +0000 Subject: 2013-10-02 Jonathan Wakely Daniel Krugler PR libstdc++/58569 * include/std/functional (function::_CheckResult): Move to namespace scope and rename to __check_func_return_type. * testsuite/20_util/function/58569.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203133 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 +++++++ libstdc++-v3/include/std/functional | 14 ++++-------- libstdc++-v3/testsuite/20_util/function/58569.cc | 29 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/function/58569.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bd5f220c061..2efb8236c67 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-10-02 Jonathan Wakely + Daniel Krugler + + PR libstdc++/58569 + * include/std/functional (function::_CheckResult): Move to namespace + scope and rename to __check_func_return_type. + * testsuite/20_util/function/58569.cc: New. + 2013-09-30 Chris Jefferson PR libstdc++/58437 diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 0807a714462..422966f5f3c 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -2160,6 +2160,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) } }; + template + using __check_func_return_type + = __or_, is_convertible<_From, _To>>; + /** * @brief Primary class template for std::function. * @ingroup functors @@ -2177,16 +2181,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) using _Invoke = decltype(__callable_functor(std::declval<_Functor&>()) (std::declval<_ArgTypes>()...) ); - template - struct _CheckResult - : is_convertible<_CallRes, _Res1> { }; - - template - struct _CheckResult<_CallRes, void> - : true_type { }; - template - using _Callable = _CheckResult<_Invoke<_Functor>, _Res>; + using _Callable = __check_func_return_type<_Invoke<_Functor>, _Res>; template using _Requires = typename enable_if<_Cond::value, _Tp>::type; diff --git a/libstdc++-v3/testsuite/20_util/function/58569.cc b/libstdc++-v3/testsuite/20_util/function/58569.cc new file mode 100644 index 00000000000..f1e67bc5ab9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/58569.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// libstdc++/58569 + +#include + +struct foo { + std::function x; + std::function y; +}; + +foo a; -- cgit v1.2.3 From fba7a9bb662bda4bcf1236c7852a65bd835ed0b2 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 2 Oct 2013 23:49:58 +0000 Subject: runtime: Fix append of slice with elements of zero size. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203141 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-append.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libgo/runtime/go-append.c b/libgo/runtime/go-append.c index 12fe876cb95..8d5dee21616 100644 --- a/libgo/runtime/go-append.c +++ b/libgo/runtime/go-append.c @@ -24,24 +24,24 @@ __go_append (struct __go_open_array a, void *bvalues, uintptr_t bcount, uintptr_t element_size) { uintptr_t ucount; - int count; + intgo count; if (bvalues == NULL || bcount == 0) return a; ucount = (uintptr_t) a.__count + bcount; - count = (int) ucount; + count = (intgo) ucount; if ((uintptr_t) count != ucount || count <= a.__count) runtime_panicstring ("append: slice overflow"); if (count > a.__capacity) { - int m; + intgo m; void *n; m = a.__capacity; - if (m == 0) - m = (int) bcount; + if (m + m < count) + m = count; else { do @@ -54,7 +54,7 @@ __go_append (struct __go_open_array a, void *bvalues, uintptr_t bcount, while (m < count); } - if ((uintptr) m > MaxMem / element_size) + if (element_size > 0 && (uintptr) m > MaxMem / element_size) runtime_panicstring ("growslice: cap out of range"); n = __go_alloc (m * element_size); -- cgit v1.2.3 From b5b23eb507968a24925bba612566be57dad008cc Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 3 Oct 2013 00:08:12 +0000 Subject: 2013-10-02 Michael Meissner Backport from mainline 2013-10-02 Michael Meissner PR target/58587 * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off setting -mvsx-timode by default until the underlying problem is fixed. (RS6000_CPU, power7 defaults): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@203143 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.ibm | 11 +++++++++++ gcc/config/rs6000/rs6000-cpus.def | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index 81306b5bed1..23cbc063cc2 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -1,3 +1,14 @@ +2013-10-02 Michael Meissner + + Backport from mainline + 2013-10-02 Michael Meissner + + PR target/58587 + * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off + setting -mvsx-timode by default until the underlying problem is + fixed. + (RS6000_CPU, power7 defaults): Likewise. + 2013-08-19 Peter Bergner Backport from mainline diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index c177512ddfd..548566eee8b 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -38,12 +38,13 @@ /* For ISA 2.06, don't add ISEL, since in general it isn't a win, but altivec is a win so enable it. */ + /* OPTION_MASK_VSX_TIMODE should be set, but disable it for now until + PR 58587 is fixed. */ #define ISA_2_6_MASKS_EMBEDDED (ISA_2_5_MASKS_EMBEDDED | OPTION_MASK_POPCNTD) #define ISA_2_6_MASKS_SERVER (ISA_2_5_MASKS_SERVER \ | OPTION_MASK_POPCNTD \ | OPTION_MASK_ALTIVEC \ - | OPTION_MASK_VSX \ - | OPTION_MASK_VSX_TIMODE) + | OPTION_MASK_VSX) /* For now, don't provide an embedded version of ISA 2.07. */ #define ISA_2_7_MASKS_SERVER (ISA_2_6_MASKS_SERVER \ @@ -182,7 +183,7 @@ RS6000_CPU ("power6x", PROCESSOR_POWER6, MASK_POWERPC64 | MASK_PPC_GPOPT RS6000_CPU ("power7", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD - | MASK_VSX | MASK_RECIP_PRECISION | MASK_VSX_TIMODE) + | MASK_VSX | MASK_RECIP_PRECISION) RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0) RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64) -- cgit v1.2.3 From faef4d5674f669db35b4769f131da65c567d1cf1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 3 Oct 2013 00:16:58 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203145 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f208a685f7d..c2a19eba9a8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131002 +20131003 -- cgit v1.2.3 From df0d253bfa635304fcedda02ec015c285000bf61 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Thu, 3 Oct 2013 00:47:24 +0000 Subject: * config.gcc (hppa*64*-*-linux*): Don't add pa/t-linux to tmake_file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203149 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config.gcc | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ff1d2f7e956..45f86f59016 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-02 John David Anglin + + * config.gcc (hppa*64*-*-linux*): Don't add pa/t-linux to tmake_file. + 2013-10-01 Jakub Jelinek Andreas Krebbel diff --git a/gcc/config.gcc b/gcc/config.gcc index 483e8e06942..92d57ddf4fb 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1059,7 +1059,6 @@ hppa*64*-*-linux*) tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \ glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \ pa/pa64-linux.h" - tmake_file="${tmake_file} pa/t-linux" gas=yes gnu_ld=yes need_64bit_hwint=yes ;; -- cgit v1.2.3 From 8b99dbd4076f46d9b68e0ed3c33a384eb3ec87aa Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 3 Oct 2013 21:44:35 +0000 Subject: * sr.po: Update. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203192 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/po/ChangeLog | 4 +++ libcpp/po/sr.po | 88 +++++++++++++++-------------------------------------- 2 files changed, 28 insertions(+), 64 deletions(-) diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index 5d7be88a429..fc7b0a6d47a 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2013-10-03 Joseph Myers + + * sr.po: Update. + 2013-05-31 Release Manager * GCC 4.8.1 released. diff --git a/libcpp/po/sr.po b/libcpp/po/sr.po index c9416c4af76..ef7dbc3e695 100644 --- a/libcpp/po/sr.po +++ b/libcpp/po/sr.po @@ -1,13 +1,13 @@ # Serbian translation of cpplib. # Copyright (C) 2012 Free Software Foundation, Inc. # This file is distributed under the same license as the gcc package. -# Мирослав Николић , 2012. +# Мирослав Николић , 2012, 2013. msgid "" msgstr "" -"Project-Id-Version: cpplib-4.7.0\n" +"Project-Id-Version: cpplib-4.8.0\n" "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" -"POT-Creation-Date: 2013-02-24 01:05+0000\n" -"PO-Revision-Date: 2012-06-13 11:32+0200\n" +"POT-Creation-Date: 2013-03-15 17:42+0000\n" +"PO-Revision-Date: 2013-10-03 08:53+0200\n" "Last-Translator: Мирослав Николић \n" "Language-Team: Serbian \n" "Language: sr\n" @@ -340,14 +340,13 @@ msgid "current file is older than %s" msgstr "текућа датотека је старија од %s" #: directives.c:1653 -#, fuzzy, c-format -#| msgid "invalid #pragma GCC poison directive" +#, c-format msgid "invalid \"#pragma GCC %s\" directive" -msgstr "неисправна „#pragma GCC poison“ директива" +msgstr "неисправна директива „#pragma GCC %s“" #: directives.c:1847 msgid "_Pragma takes a parenthesized string literal" -msgstr "_Прагма узима словност ниске затворену заградом" +msgstr "_Прагма узима словност ниске затворене заградом" #: directives.c:1968 msgid "#else without #if" @@ -398,7 +397,7 @@ msgstr "предикат мора бити одредник" msgid "\"%s\" re-asserted" msgstr "„%s“ је поново утврђен" -#: directives.c:2566 +#: directives.c:2567 #, c-format msgid "unterminated #%s" msgstr "неокончано #%s" @@ -570,39 +569,39 @@ msgstr "оператор зареза у операнду „#if“" msgid "division by zero in #if" msgstr "дељење нулом у „#if“" -#: files.c:504 +#: files.c:505 msgid "NULL directory in find_file" msgstr "НИШТАВАН директоријум у пронађи_датотеку" -#: files.c:542 +#: files.c:553 msgid "one or more PCH files were found, but they were invalid" msgstr "једна или више ПЦХ датотека је пронађено, али су неисправне" -#: files.c:545 +#: files.c:556 msgid "use -Winvalid-pch for more information" msgstr "користите „-Winvalid-pch“ за више података" -#: files.c:643 +#: files.c:660 #, c-format msgid "%s is a block device" msgstr "%s је блок уређај" -#: files.c:660 +#: files.c:677 #, c-format msgid "%s is too large" msgstr "%s је превелико" -#: files.c:700 +#: files.c:717 #, c-format msgid "%s is shorter than expected" msgstr "%s је краће од очекиваног" -#: files.c:935 +#: files.c:953 #, c-format msgid "no include path in which to search for %s" msgstr "нема путање укључивања у којој потражити „%s“" -#: files.c:1363 +#: files.c:1381 msgid "Multiple include guards may be useful for:\n" msgstr "Више чувара укључивања може бити корисно за:\n" @@ -710,7 +709,7 @@ msgstr "неокончана сирова ниска" #: lex.c:1573 lex.c:1706 msgid "invalid suffix on literal; C++11 requires a space between literal and identifier" -msgstr "" +msgstr "неисправан суфикс у словности; Ц++11 захтева размак између словности и одредника" #: lex.c:1684 msgid "null character(s) preserved in literal" @@ -863,36 +862,36 @@ msgstr "макро аргумент „%s“ ће бити нискован у msgid "invalid hash type %d in cpp_macro_definition" msgstr "неисправна врста хеша %d у цпп_макро_одредници" -#: pch.c:87 pch.c:335 pch.c:347 pch.c:365 pch.c:371 pch.c:380 pch.c:387 +#: pch.c:87 pch.c:345 pch.c:359 pch.c:377 pch.c:383 pch.c:392 pch.c:399 msgid "while writing precompiled header" msgstr "за време уписивања претходно преведеног заглавља" -#: pch.c:607 +#: pch.c:619 #, c-format msgid "%s: not used because `%.*s' is poisoned" msgstr "%s: није употребљено зато што је „%.*s“ отровано" -#: pch.c:629 +#: pch.c:641 #, c-format msgid "%s: not used because `%.*s' not defined" msgstr "%s: није употребљено зато што „%.*s“ није одређено" -#: pch.c:641 +#: pch.c:653 #, c-format msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'" msgstr "%s: није употребљено зато што „%.*s“ одређено као „%s“ није „%.*s“" -#: pch.c:682 +#: pch.c:694 #, c-format msgid "%s: not used because `%s' is defined" msgstr "%s: није употребљено зато што је „%s“ одређено" -#: pch.c:702 +#: pch.c:714 #, c-format msgid "%s: not used because `__COUNTER__' is invalid" msgstr "%s: није употребљено зато што „__COUNTER__“ није исправно" -#: pch.c:711 pch.c:886 +#: pch.c:723 pch.c:898 msgid "while reading precompiled header" msgstr "за време читања претходно преведеног заглавља" @@ -904,42 +903,3 @@ msgstr "откривено је дубачење за време ширења м #: traditional.c:968 msgid "syntax error in macro parameter list" msgstr "садржајна грешка у списку параметара макроа" - -#~ msgid "too many decimal points in number" -#~ msgstr "превише децималних тачака у броју" - -#~ msgid "invalid digit \"%c\" in binary constant" -#~ msgstr "неисправна цифра „%c“ у бинарној константи" - -#~ msgid "invalid digit \"%c\" in octal constant" -#~ msgstr "неисправна цифра „%c“ у окталној константи" - -#~ msgid "no digits in hexadecimal floating constant" -#~ msgstr "нема цифара у хексадецималној покретној константи" - -#~ msgid "exponent has no digits" -#~ msgstr "изложилац нема цифру" - -#~ msgid "hexadecimal floating constants require an exponent" -#~ msgstr "хексадецималне покретне константе захтевају изложилац" - -#~ msgid "missing binary operator before token \"%s\"" -#~ msgstr "недостаје бинарни оператор пре симбола „%s“" - -#~ msgid "token \"%s\" is not valid in preprocessor expressions" -#~ msgstr "симбол „%s“ није исправан у изразима претпроцесора" - -#~ msgid "missing expression between '(' and ')'" -#~ msgstr "недостаје израз између ( и )" - -#~ msgid "%s with no expression" -#~ msgstr "%s без израза" - -#~ msgid "operator '%s' has no right operand" -#~ msgstr "оператор „%s“ нема десни операнд" - -#~ msgid "operator '%s' has no left operand" -#~ msgstr "оператор „%s“ нема леви операнд" - -#~ msgid " ':' without preceding '?'" -#~ msgstr " „:“ без предводећег „?“" -- cgit v1.2.3 From 5ddc28e096a9b5bf05c911f32670174af2ba57f5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 4 Oct 2013 00:16:47 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203196 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c2a19eba9a8..7e4403c96da 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131003 +20131004 -- cgit v1.2.3 From 5edf63480410ed0f3f6519433bba525e1edde6e8 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 4 Oct 2013 10:06:23 +0000 Subject: 2013-10-04 Tobias Burnus PR fortran/55469 * io/list_read (parse_repeat, read_integer, read_character, parse_real, read_real, check_type, list_formatted_read_scalar, finish_list_read): Call list_free. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203201 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/io/list_read.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 5a44bdf78aa..60f4549cd20 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -616,6 +616,7 @@ parse_repeat (st_parameter_dt *dtp) free_saved (dtp); if (c == EOF) { + free_line (dtp); hit_eof (dtp); return 1; } @@ -905,11 +906,14 @@ read_integer (st_parameter_dt *dtp, int length) free_saved (dtp); if (c == EOF) { + free_line (dtp); hit_eof (dtp); return; } else if (c != '\n') eat_line (dtp); + + free_line (dtp); snprintf (message, MSGLEN, "Bad integer for item %d in list input", dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); @@ -1079,7 +1083,6 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) unget_char (dtp, c); eat_separator (dtp); dtp->u.p.saved_type = BT_CHARACTER; - free_line (dtp); } else { @@ -1088,10 +1091,12 @@ read_character (st_parameter_dt *dtp, int length __attribute__ ((unused))) dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); } + free_line (dtp); return; eof: free_saved (dtp); + free_line (dtp); hit_eof (dtp); } @@ -1286,11 +1291,14 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) free_saved (dtp); if (c == EOF) { + free_line (dtp); hit_eof (dtp); return 1; } else if (c != '\n') eat_line (dtp); + + free_line (dtp); snprintf (message, MSGLEN, "Bad floating point number for item %d", dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); @@ -1391,11 +1399,14 @@ eol_4: free_saved (dtp); if (c == EOF) { + free_line (dtp); hit_eof (dtp); return; } else if (c != '\n') eat_line (dtp); + + free_line (dtp); snprintf (message, MSGLEN, "Bad complex value in item %d of list input", dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); @@ -1630,7 +1641,10 @@ read_real (st_parameter_dt *dtp, void * dest, int length) eat_separator (dtp); push_char (dtp, '\0'); if (convert_real (dtp, dest, dtp->u.p.saved_string, length)) - return; + { + free_saved (dtp); + return; + } free_saved (dtp); dtp->u.p.saved_type = BT_REAL; @@ -1768,12 +1782,14 @@ read_real (st_parameter_dt *dtp, void * dest, int length) free_saved (dtp); if (c == EOF) { + free_line (dtp); hit_eof (dtp); return; } else if (c != '\n') eat_line (dtp); + free_line (dtp); snprintf (message, MSGLEN, "Bad real number in item %d of list input", dtp->u.p.item_count); generate_error (&dtp->common, LIBERROR_READ_VALUE, message); @@ -1790,6 +1806,7 @@ check_type (st_parameter_dt *dtp, bt type, int len) if (dtp->u.p.saved_type != BT_UNKNOWN && dtp->u.p.saved_type != type) { + free_line (dtp); snprintf (message, MSGLEN, "Read type %s where %s was expected for item %d", type_name (dtp->u.p.saved_type), type_name (type), dtp->u.p.item_count); @@ -1803,6 +1820,7 @@ check_type (st_parameter_dt *dtp, bt type, int len) if (dtp->u.p.saved_length != len) { + free_line (dtp); snprintf (message, MSGLEN, "Read kind %d %s where kind %d is required for item %d", dtp->u.p.saved_length, type_name (dtp->u.p.saved_type), len, @@ -1976,7 +1994,10 @@ list_formatted_read_scalar (st_parameter_dt *dtp, bt type, void *p, cleanup: if (err == LIBERROR_END) - hit_eof (dtp); + { + free_line (dtp); + hit_eof (dtp); + } return err; } @@ -2024,7 +2045,10 @@ finish_list_read (st_parameter_dt *dtp) err = eat_line (dtp); if (err == LIBERROR_END) - hit_eof (dtp); + { + free_line (dtp); + hit_eof (dtp); + } } /* NAMELIST INPUT -- cgit v1.2.3 From ab85fc27adaf268947da2fd64a3beb73efa8acef Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 4 Oct 2013 10:08:57 +0000 Subject: Add missing changelog entry for Rev. 203201: 2013-10-04 Tobias Burnus PR fortran/55469 * io/list_read (parse_repeat, read_integer, read_character, parse_real, read_real, check_type, list_formatted_read_scalar, finish_list_read): Call list_free. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203202 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 8b9eba12f0a..a20f5bb8092 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2013-10-04 Tobias Burnus + + PR fortran/55469 + * io/list_read (parse_repeat, read_integer, read_character, + parse_real, read_real, check_type, list_formatted_read_scalar, + finish_list_read): Call list_free. + 2013-06-21 Uros Bizjak Backport from mainline -- cgit v1.2.3 From 29cd4db10913218f6b5188619d74fcc750f5cc54 Mon Sep 17 00:00:00 2001 From: Marcus Shawcroft Date: Fri, 4 Oct 2013 14:57:04 +0000 Subject: [AArch64] Fix PR58460. 2013-10-04 Marcus Shawcroft Backport from mainline. PR target/58460 * config/aarch64/aarch64.md (*add__) (*add__si_uxtw,*add_mul_imm_) (*sub__) (*sub__si_uxtw,*sub_mul_imm_, *sub_mul_imm_si_uxtw): Remove k constraint. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203204 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 ++++++++++ gcc/config/aarch64/aarch64.md | 14 ++++++------ gcc/testsuite/ChangeLog | 7 ++++++ gcc/testsuite/gcc.target/aarch64/pr58460.c | 35 ++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr58460.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45f86f59016..4fbfbeff4fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-10-04 Marcus Shawcroft + + Backport from mainline. + + PR target/58460 + * config/aarch64/aarch64.md (*add__) + (*add__si_uxtw,*add_mul_imm_) + (*sub__) + (*sub__si_uxtw,*sub_mul_imm_, *sub_mul_imm_si_uxtw): + Remove k constraint. + 2013-10-02 John David Anglin * config.gcc (hppa*64*-*-linux*): Don't add pa/t-linux to tmake_file. diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 5b87b3c37fd..04a5e01f9cf 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1313,7 +1313,7 @@ ) (define_insn "*add__" - [(set (match_operand:GPI 0 "register_operand" "=rk") + [(set (match_operand:GPI 0 "register_operand" "=r") (plus:GPI (ASHIFT:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_shift_imm_" "n")) (match_operand:GPI 3 "register_operand" "r")))] @@ -1325,7 +1325,7 @@ ;; zero_extend version of above (define_insn "*add__si_uxtw" - [(set (match_operand:DI 0 "register_operand" "=rk") + [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (plus:SI (ASHIFT:SI (match_operand:SI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_shift_imm_si" "n")) @@ -1337,7 +1337,7 @@ ) (define_insn "*add_mul_imm_" - [(set (match_operand:GPI 0 "register_operand" "=rk") + [(set (match_operand:GPI 0 "register_operand" "=r") (plus:GPI (mult:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_pwr_2_" "n")) (match_operand:GPI 3 "register_operand" "r")))] @@ -1660,7 +1660,7 @@ ) (define_insn "*sub__" - [(set (match_operand:GPI 0 "register_operand" "=rk") + [(set (match_operand:GPI 0 "register_operand" "=r") (minus:GPI (match_operand:GPI 3 "register_operand" "r") (ASHIFT:GPI (match_operand:GPI 1 "register_operand" "r") @@ -1673,7 +1673,7 @@ ;; zero_extend version of above (define_insn "*sub__si_uxtw" - [(set (match_operand:DI 0 "register_operand" "=rk") + [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (minus:SI (match_operand:SI 3 "register_operand" "r") (ASHIFT:SI @@ -1686,7 +1686,7 @@ ) (define_insn "*sub_mul_imm_" - [(set (match_operand:GPI 0 "register_operand" "=rk") + [(set (match_operand:GPI 0 "register_operand" "=r") (minus:GPI (match_operand:GPI 3 "register_operand" "r") (mult:GPI (match_operand:GPI 1 "register_operand" "r") @@ -1699,7 +1699,7 @@ ;; zero_extend version of above (define_insn "*sub_mul_imm_si_uxtw" - [(set (match_operand:DI 0 "register_operand" "=rk") + [(set (match_operand:DI 0 "register_operand" "=r") (zero_extend:DI (minus:SI (match_operand:SI 3 "register_operand" "r") (mult:SI diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f562af9eac7..6ccd4481141 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2013-10-04 Marcus Shawcroft + + Backport from mainline. + + PR target/58460 + * gcc.target/aarch64/pr58460.c: New file. + 2013-10-02 Paolo Carlini PR c++/58535 diff --git a/gcc/testsuite/gcc.target/aarch64/pr58460.c b/gcc/testsuite/gcc.target/aarch64/pr58460.c new file mode 100644 index 00000000000..a7e149a371c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr58460.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O" } */ +extern unsigned long x1; + +char * +f (char *a, char *b) +{ + return a; +} + +int +g (char *a) +{ + return 2; +} + +void +h (char *p[]) +{ + char n[x1][512]; + char *l = f (p[1], " "); + if (g (p[0])) + n[0][0] = '\0'; + while (l && *l) + { + } +} + +unsigned long x1; + +int +main () +{ + return 0; +} -- cgit v1.2.3 From c31ed3b3d6350cb7dfe26aff2e05a5d236ca158e Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 4 Oct 2013 16:25:55 +0000 Subject: 2013-10-04 Tobias Burnus Backport from mainline 2013-09-25 Tobias Burnus PR fortran/57697 PR fortran/58469 * resolve.c (generate_component_assignments): Avoid double free at runtime and freeing a still-being used expr. 2013-10-04 Tobias Burnus Backport from mainline 2013-09-25 Tobias Burnus PR fortran/57697 PR fortran/58469 * gfortran.dg/defined_assignment_8.f90: New. * gfortran.dg/defined_assignment_9.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203207 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 10 +++ gcc/fortran/resolve.c | 85 +++++++++++++++++++--- gcc/testsuite/ChangeLog | 10 +++ .../gfortran.dg/defined_assignment_10.f90 | 37 ++++++++++ .../gfortran.dg/defined_assignment_11.f90 | 43 +++++++++++ gcc/testsuite/gfortran.dg/defined_assignment_8.f90 | 40 ++++++++++ gcc/testsuite/gfortran.dg/defined_assignment_9.f90 | 45 ++++++++++++ 7 files changed, 261 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/defined_assignment_10.f90 create mode 100644 gcc/testsuite/gfortran.dg/defined_assignment_11.f90 create mode 100644 gcc/testsuite/gfortran.dg/defined_assignment_8.f90 create mode 100644 gcc/testsuite/gfortran.dg/defined_assignment_9.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d3a136fe8b5..2f623b6b864 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2013-10-04 Tobias Burnus + + Backport from mainline + 2013-09-25 Tobias Burnus + + PR fortran/57697 + PR fortran/58469 + * resolve.c (generate_component_assignments): Avoid double free + at runtime and freeing a still-being used expr. + 2013-08-24 Mikael Morin PR fortran/57798 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index a5966b18db0..486a22c2de5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -9997,6 +9997,26 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns) temp_code = build_assignment (EXEC_ASSIGN, t1, (*code)->expr1, NULL, NULL, (*code)->loc); + + /* For allocatable LHS, check whether it is allocated. Note + that allocatable components with defined assignment are + not yet support. See PR 57696. */ + if ((*code)->expr1->symtree->n.sym->attr.allocatable) + { + gfc_code *block; + gfc_expr *e = + gfc_lval_expr_from_sym ((*code)->expr1->symtree->n.sym); + block = gfc_get_code (); + block->op = EXEC_IF; + block->block = gfc_get_code (); + block->block->op = EXEC_IF; + block->block->expr1 + = gfc_build_intrinsic_call (ns, + GFC_ISYM_ALLOCATED, "allocated", + (*code)->loc, 1, e); + block->block->next = temp_code; + temp_code = block; + } add_code_to_chain (&temp_code, &tmp_head, &tmp_tail); } @@ -10005,8 +10025,37 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns) gfc_free_expr (this_code->ext.actual->expr); this_code->ext.actual->expr = gfc_copy_expr (t1); add_comp_ref (this_code->ext.actual->expr, comp1); + + /* If the LHS variable is allocatable and wasn't allocated and + the temporary is allocatable, pointer assign the address of + the freshly allocated LHS to the temporary. */ + if ((*code)->expr1->symtree->n.sym->attr.allocatable + && gfc_expr_attr ((*code)->expr1).allocatable) + { + gfc_code *block; + gfc_expr *cond; + + cond = gfc_get_expr (); + cond->ts.type = BT_LOGICAL; + cond->ts.kind = gfc_default_logical_kind; + cond->expr_type = EXPR_OP; + cond->where = (*code)->loc; + cond->value.op.op = INTRINSIC_NOT; + cond->value.op.op1 = gfc_build_intrinsic_call (ns, + GFC_ISYM_ALLOCATED, "allocated", + (*code)->loc, 1, gfc_copy_expr (t1)); + block = gfc_get_code (); + block->op = EXEC_IF; + block->block = gfc_get_code (); + block->block->op = EXEC_IF; + block->block->expr1 = cond; + block->block->next = build_assignment (EXEC_POINTER_ASSIGN, + t1, (*code)->expr1, + NULL, NULL, (*code)->loc); + add_code_to_chain (&block, &head, &tail); + } } - } + } else if (this_code->op == EXEC_ASSIGN && !this_code->next) { /* Don't add intrinsic assignments since they are already @@ -10028,13 +10077,6 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns) } } - /* This is probably not necessary. */ - if (this_code) - { - gfc_free_statements (this_code); - this_code = NULL; - } - /* Put the temporary assignments at the top of the generated code. */ if (tmp_head && component_assignment_level == 1) { @@ -10043,6 +10085,30 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns) tmp_head = tmp_tail = NULL; } + // If we did a pointer assignment - thus, we need to ensure that the LHS is + // not accidentally deallocated. Hence, nullify t1. + if (t1 && (*code)->expr1->symtree->n.sym->attr.allocatable + && gfc_expr_attr ((*code)->expr1).allocatable) + { + gfc_code *block; + gfc_expr *cond; + gfc_expr *e; + + e = gfc_lval_expr_from_sym ((*code)->expr1->symtree->n.sym); + cond = gfc_build_intrinsic_call (ns, GFC_ISYM_ASSOCIATED, "associated", + (*code)->loc, 2, gfc_copy_expr (t1), e); + block = gfc_get_code (); + block->op = EXEC_IF; + block->block = gfc_get_code (); + block->block->op = EXEC_IF; + block->block->expr1 = cond; + block->block->next = build_assignment (EXEC_POINTER_ASSIGN, + t1, gfc_get_null_expr (&(*code)->loc), + NULL, NULL, (*code)->loc); + gfc_append_code (tail, block); + tail = block; + } + /* Now attach the remaining code chain to the input code. Step on to the end of the new code since resolution is complete. */ gcc_assert ((*code)->op == EXEC_ASSIGN); @@ -10052,7 +10118,8 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns) gfc_free_expr ((*code)->expr1); gfc_free_expr ((*code)->expr2); **code = *head; - free (head); + if (head != tail) + free (head); *code = tail; component_assignment_level--; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ccd4481141..7c75ceb566d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2013-10-04 Tobias Burnus + + Backport from mainline + 2013-09-25 Tobias Burnus + + PR fortran/57697 + PR fortran/58469 + * gfortran.dg/defined_assignment_8.f90: New. + * gfortran.dg/defined_assignment_9.f90: New. + 2013-10-04 Marcus Shawcroft Backport from mainline. diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_10.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_10.f90 new file mode 100644 index 00000000000..1ccc49f2957 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/defined_assignment_10.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! +! PR fortran/57697 +! +! Further test of typebound defined assignment +! +module m0 + implicit none + type component + integer :: i = 42 + contains + procedure :: assign0 + generic :: assignment(=) => assign0 + end type + type parent + type(component) :: foo + end type +contains + elemental subroutine assign0(lhs,rhs) + class(component), intent(INout) :: lhs + class(component), intent(in) :: rhs + lhs%i = 20 + end subroutine +end module + +program main + use m0 + implicit none +block + type(parent), allocatable :: left + type(parent) :: right +! print *, right%foo + left = right +! print *, left%foo +! if (left%foo%i /= 20) call abort() +end block +end diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_11.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_11.f90 new file mode 100644 index 00000000000..ec297d5492a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/defined_assignment_11.f90 @@ -0,0 +1,43 @@ +! { dg-do run } +! +! PR fortran/57697 +! +! Further test of typebound defined assignment +! +module m0 + implicit none + type :: component + integer :: i = 42 + integer, allocatable :: b + contains + procedure :: assign0 + generic :: assignment(=) => assign0 + end type + type, extends(component) :: comp2 + real :: aa + end type comp2 + type parent + type(component) :: foo + real :: cc + end type + type p2 + type(parent) :: x + end type p2 +contains + elemental subroutine assign0(lhs,rhs) + class(component), intent(INout) :: lhs + class(component), intent(in) :: rhs + lhs%i = 20 + end subroutine +end module + +program main + use m0 + implicit none + type(p2), allocatable :: left + type(p2) :: right +! print *, right%x%foo%i + left = right +! print *, left%x%foo%i + if (left%x%foo%i /= 20) call abort() +end diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_8.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_8.f90 new file mode 100644 index 00000000000..aab808583ad --- /dev/null +++ b/gcc/testsuite/gfortran.dg/defined_assignment_8.f90 @@ -0,0 +1,40 @@ +! { dg-do compile } +! +! PR fortran/58469 +! +! Related: PR fortran/57697 +! +! Was ICEing before +! +module m0 + implicit none + type :: component + integer :: i = 42 + contains + procedure :: assign0 + generic :: assignment(=) => assign0 + end type + type, extends(component) :: comp2 + real :: aa + end type comp2 + type parent + type(comp2) :: foo + end type +contains + elemental subroutine assign0(lhs,rhs) + class(component), intent(INout) :: lhs + class(component), intent(in) :: rhs + lhs%i = 20 + end subroutine +end module + +program main + use m0 + implicit none + type(parent), allocatable :: left + type(parent) :: right + print *, right%foo + left = right + print *, left%foo + if (left%foo%i /= 42) call abort() +end diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_9.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_9.f90 new file mode 100644 index 00000000000..50fa0070f18 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/defined_assignment_9.f90 @@ -0,0 +1,45 @@ +! { dg-do run } +! +! PR fortran/57697 +! +! Further test of typebound defined assignment +! +module m0 + implicit none + type component + integer :: i = 42 + contains + procedure :: assign0 + generic :: assignment(=) => assign0 + end type + type parent + type(component) :: foo + end type +contains + elemental subroutine assign0(lhs,rhs) + class(component), intent(INout) :: lhs + class(component), intent(in) :: rhs + lhs%i = 20 + end subroutine +end module + +program main + use m0 + implicit none + block + type(parent), allocatable :: left + type(parent) :: right +! print *, right%foo + left = right +! print *, left%foo + if (left%foo%i /= 20) call abort() + end block + block + type(parent), allocatable :: left(:) + type(parent) :: right(5) +! print *, right%foo + left = right +! print *, left%foo + if (any (left%foo%i /= 20)) call abort() + end block +end -- cgit v1.2.3 From a135cf7c5169df7681e6f47740bdff10d9226cec Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 4 Oct 2013 16:54:55 +0000 Subject: Correct ChangeLog for PR fortran/57697 git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203208 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c75ceb566d..d26b870fe67 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,12 +1,11 @@ 2013-10-04 Tobias Burnus - Backport from mainline - 2013-09-25 Tobias Burnus - PR fortran/57697 PR fortran/58469 * gfortran.dg/defined_assignment_8.f90: New. * gfortran.dg/defined_assignment_9.f90: New. + * gfortran.dg/defined_assignment_10.f90: New. + * gfortran.dg/defined_assignment_11.f90: New. 2013-10-04 Marcus Shawcroft -- cgit v1.2.3 From bf40b59946a8a0a0afee2c6545621116122685e4 Mon Sep 17 00:00:00 2001 From: Chris Manghane Date: Fri, 4 Oct 2013 18:07:35 +0000 Subject: compiler: Use backend interface for temporary reference expressions. * go-gcc.cc (Backend::convert_expression): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203210 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 4 ++++ gcc/go/go-gcc.cc | 17 +++++++++++++++++ gcc/go/gofrontend/backend.h | 4 ++++ gcc/go/gofrontend/expressions.cc | 17 +++++++++-------- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index a0a62197464..0a423810851 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2013-10-04 Chris Manghane + + * go-gcc.cc (Backend::convert_expression): New function. + 2013-10-02 Chris Manghane * go-gcc.cc: Include "real.h" and "realmpfr.h". diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 55b60ade21d..fcfd41b34ab 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -229,6 +229,9 @@ class Gcc_backend : public Backend Bexpression* complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag); + Bexpression* + convert_expression(Btype* type, Bexpression* expr, Location); + // Statements. Bstatement* @@ -949,6 +952,20 @@ Gcc_backend::complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag) return tree_to_expr(ret); } +// An expression that converts an expression to a different type. + +Bexpression* +Gcc_backend::convert_expression(Btype* type, Bexpression* expr, Location) +{ + tree type_tree = type->get_tree(); + tree expr_tree = expr->get_tree(); + if (type_tree == error_mark_node || expr_tree == error_mark_node) + return this->error_expression(); + + tree ret = fold_convert(type_tree, expr_tree); + return tree_to_expr(ret); +} + // An expression as a statement. Bstatement* diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index d0abdd7f798..fa3e3cc6893 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -262,6 +262,10 @@ class Backend virtual Bexpression* complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag) = 0; + // Return an expression that converts EXPR to TYPE. + virtual Bexpression* + convert_expression(Btype* type, Bexpression* expr, Location) = 0; + // Statements. // Create an error statement. This is used for cases which should diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 67bec710df5..13d4c1c789a 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -995,23 +995,24 @@ Temporary_reference_expression::do_address_taken(bool) tree Temporary_reference_expression::do_get_tree(Translate_context* context) { + Gogo* gogo = context->gogo(); Bvariable* bvar = this->statement_->get_backend_variable(context); + Bexpression* ret = gogo->backend()->var_expression(bvar, this->location()); - // The gcc backend can't represent the same set of recursive types + // The backend can't always represent the same set of recursive types // that the Go frontend can. In some cases this means that a // temporary variable won't have the right backend type. Correct // that here by adding a type cast. We need to use base() to push // the circularity down one level. - tree ret = var_to_tree(bvar); + Type* stype = this->statement_->type(); if (!this->is_lvalue_ - && POINTER_TYPE_P(TREE_TYPE(ret)) - && VOID_TYPE_P(TREE_TYPE(TREE_TYPE(ret)))) + && stype->has_pointer() + && stype->deref()->is_void_type()) { - Btype* type_btype = this->type()->base()->get_backend(context->gogo()); - tree type_tree = type_to_tree(type_btype); - ret = fold_convert_loc(this->location().gcc_location(), type_tree, ret); + Btype* btype = this->type()->base()->get_backend(gogo); + ret = gogo->backend()->convert_expression(btype, ret, this->location()); } - return ret; + return expr_to_tree(ret); } // Ast dump for temporary reference. -- cgit v1.2.3 From 920e78999eea434cd504c9a15bd74dcdaeb546cb Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 4 Oct 2013 18:52:37 +0000 Subject: reflect: Fix calling Interface method on value created by MakeFunc. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203213 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/reflect/all_test.go | 24 ++++++++++++++++++++++++ libgo/go/reflect/makefunc.go | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go index 140a068b9ca..526f09bb2ca 100644 --- a/libgo/go/reflect/all_test.go +++ b/libgo/go/reflect/all_test.go @@ -1454,6 +1454,30 @@ func TestMakeFunc(t *testing.T) { } } +func TestMakeFuncInterface(t *testing.T) { + switch runtime.GOARCH { + case "amd64", "386": + default: + t.Skip("MakeFunc not implemented for " + runtime.GOARCH) + } + + fn := func(i int) int { return i } + incr := func(in []Value) []Value { + return []Value{ValueOf(int(in[0].Int() + 1))} + } + fv := MakeFunc(TypeOf(fn), incr) + ValueOf(&fn).Elem().Set(fv) + if r := fn(2); r != 3 { + t.Errorf("Call returned %d, want 3", r) + } + if r := fv.Call([]Value{ValueOf(14)})[0].Int(); r != 15 { + t.Errorf("Call returned %d, want 15", r) + } + if r := fv.Interface().(func(int) int)(26); r != 27 { + t.Errorf("Call returned %d, want 27", r) + } +} + type Point struct { x, y int } diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go index 3e0a79258e6..3e8085bec65 100644 --- a/libgo/go/reflect/makefunc.go +++ b/libgo/go/reflect/makefunc.go @@ -63,7 +63,7 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value { impl := &makeFuncImpl{code: code, typ: ftyp, fn: fn} - return Value{t, unsafe.Pointer(impl), flag(Func) << flagKindShift} + return Value{t, unsafe.Pointer(&impl), flag(Func< Date: Sat, 5 Oct 2013 00:16:55 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203222 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7e4403c96da..eb908099226 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131004 +20131005 -- cgit v1.2.3 From 55ab0c7706099d491d96bae5d46efa54be630739 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 6 Oct 2013 00:16:32 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203226 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index eb908099226..476fa8dfe20 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131005 +20131006 -- cgit v1.2.3 From 8a5c36b8243d12e790a245c81fb1a299a6a92a89 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Sun, 6 Oct 2013 17:38:10 +0000 Subject: PR libstdc++/57465 * include/std/functional (_Function_base::_Base_manager::_M_not_empty_function): Fix overload for pointers. * testsuite/20_util/function/cons/57465.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203230 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++ libstdc++-v3/include/std/functional | 2 +- .../testsuite/20_util/function/cons/57465.cc | 31 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/20_util/function/cons/57465.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2efb8236c67..ea7fcb77cb3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-10-06 Jonathan Wakely + + PR libstdc++/57465 + * include/std/functional + (_Function_base::_Base_manager::_M_not_empty_function): Fix overload + for pointers. + * testsuite/20_util/function/cons/57465.cc: New. + 2013-10-02 Jonathan Wakely Daniel Krugler diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 422966f5f3c..64b6dae040b 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -1964,7 +1964,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) template static bool - _M_not_empty_function(const _Tp*& __fp) + _M_not_empty_function(_Tp* const& __fp) { return __fp; } template diff --git a/libstdc++-v3/testsuite/20_util/function/cons/57465.cc b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc new file mode 100644 index 00000000000..44413fbd6ef --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// libstdc++/57465 + +// { dg-options "-std=gnu++11" } + +#include +#include + +int main() +{ + using F = void(); + F* f = nullptr; + std::function x(f); + VERIFY( !x ); +} -- cgit v1.2.3 From 1ecb709af8004adbfd83ebf67b742d01fb5eb876 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 7 Oct 2013 00:16:41 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203234 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 476fa8dfe20..cab82776ebd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131006 +20131007 -- cgit v1.2.3 From 836e791a8782dff79267a9195bb45eb35c739a04 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 7 Oct 2013 07:44:15 +0000 Subject: 2013-10-07 Andreas Krebbel Backport from mainline 2013-06-27 Andreas Krebbel * gcc.target/s390/htm-1.c: New file. * gcc.target/s390/htm-nofloat-1.c: New file. * gcc.target/s390/htm-xl-intrin-1.c: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203236 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 18 ++++++------ gcc/testsuite/gcc.target/s390/htm-1.c | 37 +++++++++++++++++++++++++ gcc/testsuite/gcc.target/s390/htm-nofloat-1.c | 12 ++++++++ gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c | 37 +++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/htm-1.c create mode 100644 gcc/testsuite/gcc.target/s390/htm-nofloat-1.c create mode 100644 gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d26b870fe67..09dd554bcfe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-10-07 Andreas Krebbel + + Backport from mainline + 2013-06-27 Andreas Krebbel + + * gcc.target/s390/htm-1.c: New file. + * gcc.target/s390/htm-nofloat-1.c: New file. + * gcc.target/s390/htm-xl-intrin-1.c: New file. + 2013-10-04 Tobias Burnus PR fortran/57697 @@ -292,15 +301,6 @@ * gcc.dg/torture/pr58041.c: New test. * gcc.target/arm/pr58041.c: Likewise. -2013-08-02 Andreas Krebbel - - Backport from mainline - 2013-06-27 Andreas Krebbel - - * gcc.target/s390/htm-1.c: New file. - * gcc.target/s390/htm-nofloat-1.c: New file. - * gcc.target/s390/htm-xl-intrin-1.c: New file. - 2013-07-28 Tobias Burnus Backport from mainline diff --git a/gcc/testsuite/gcc.target/s390/htm-1.c b/gcc/testsuite/gcc.target/s390/htm-1.c new file mode 100644 index 00000000000..e6321de071e --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-1.c @@ -0,0 +1,37 @@ +/* This checks the availability of the low-level builtins introduced + for transactional execution. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -march=zEC12 -mzarch" } */ + +#include +#include + +int a = 0; +uint64_t g; + +int +foo (struct __htm_tdb* tdb) +{ + + int cc; + int n; + + cc = __builtin_tbegin (0); + cc = __builtin_tbegin (tdb); + cc = __builtin_tbegin_nofloat (0); + cc = __builtin_tbegin_nofloat (tdb); + cc = __builtin_tbegin_retry (0, 42); + cc = __builtin_tbegin_retry (tdb, 42); + cc = __builtin_tbegin_retry_nofloat (0, 42); + cc = __builtin_tbegin_retry_nofloat (tdb, 42); + __builtin_tbeginc (); + n = __builtin_tx_nesting_depth(); + __builtin_non_tx_store(&g, n); + __builtin_tabort (42 + 255); + __builtin_tend(); + __builtin_tx_assist (23); +} +/* Make sure the tdb NULL argument ends up as immediate value in the + instruction. */ +/* { dg-final { scan-assembler-times "tbegin\t0," 4 } } */ diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c new file mode 100644 index 00000000000..df7e2bac874 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=zEC12 -mzarch" } */ + +int +foo () +{ + __builtin_tbegin_nofloat (0); + __builtin_tbegin_retry_nofloat (0, 42); +} +/* Make sure no FPR saves/restores are emitted. */ +/* { dg-final { scan-assembler-not "std" } } */ +/* { dg-final { scan-assembler-not "ld" } } */ diff --git a/gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c b/gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c new file mode 100644 index 00000000000..77ceeb7706f --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-xl-intrin-1.c @@ -0,0 +1,37 @@ +/* This checks the availability of the XL compiler intrinsics for + transactional execution with the expected prototypes. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -march=zEC12 -mzarch" } */ + +#include + +int a = 0; +unsigned long g; + +int +foo () +{ + struct __htm_tdb *tdb_struct; + void * const tdb = tdb_struct; + long result; + unsigned char code; + + result = __TM_simple_begin (); + result = __TM_begin (tdb); + result = __TM_end (); + __TM_abort (); + __TM_named_abort (42); + __TM_non_transactional_store (&g, 42); + result = __TM_nesting_depth (tdb); + + result = __TM_is_user_abort (tdb); + result = __TM_is_named_user_abort (tdb, &code); + result = __TM_is_illegal (tdb); + result = __TM_is_footprint_exceeded (tdb); + result = __TM_is_nested_too_deep (tdb); + result = __TM_is_conflict (tdb); + result = __TM_is_failure_persistent (result); + result = __TM_failure_address (tdb); + result = __TM_failure_code (tdb); +} -- cgit v1.2.3 From ed8b72e1eeadf8b7cf4311213f9d73482ac23de2 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 7 Oct 2013 07:45:12 +0000 Subject: 2013-10-07 Andreas Krebbel * config/s390/s390.md ("tbegin", "tbegin_nofloat", "tbegin_retry") ("tbegin_retry_nofloat", "tend", "tabort", "tx_assist"): Remove constraint letters from expanders. ("tbegin_retry", "tbegin_retry_nofloat"): Change predicate of the retry count to general_operand. ("tabort"): Give operand 0 a mode. ("tabort_1"): Add mode and constraint letter for operand 0. * doc/extend.texi: Fix protoype of __builtin_non_tx_store. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203237 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 ++++++++ gcc/config/s390/s390.md | 28 ++++++++++---------- gcc/doc/extend.texi | 2 +- gcc/testsuite/gcc.target/s390/htm-1.c | 48 ++++++++++++++++++++++++++++++----- 4 files changed, 68 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4fbfbeff4fa..b1fc0fe6d60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-10-07 Andreas Krebbel + + * config/s390/s390.md ("tbegin", "tbegin_nofloat", "tbegin_retry") + ("tbegin_retry_nofloat", "tend", "tabort", "tx_assist"): Remove + constraint letters from expanders. + ("tbegin_retry", "tbegin_retry_nofloat"): Change predicate of the + retry count to general_operand. + ("tabort"): Give operand 0 a mode. + ("tabort_1"): Add mode and constraint letter for operand 0. + * doc/extend.texi: Fix protoype of __builtin_non_tx_store. + 2013-10-04 Marcus Shawcroft Backport from mainline. diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index da9d449530d..ad3ba27c519 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -9857,8 +9857,8 @@ ; Non-constrained transaction begin (define_expand "tbegin" - [(match_operand:SI 0 "register_operand" "=d") - (match_operand:BLK 1 "memory_operand" "=Q")] + [(match_operand:SI 0 "register_operand" "") + (match_operand:BLK 1 "memory_operand" "")] "TARGET_HTM" { s390_expand_tbegin (operands[0], operands[1], NULL_RTX, true); @@ -9866,8 +9866,8 @@ }) (define_expand "tbegin_nofloat" - [(match_operand:SI 0 "register_operand" "=d") - (match_operand:BLK 1 "memory_operand" "=Q")] + [(match_operand:SI 0 "register_operand" "") + (match_operand:BLK 1 "memory_operand" "")] "TARGET_HTM" { s390_expand_tbegin (operands[0], operands[1], NULL_RTX, false); @@ -9875,9 +9875,9 @@ }) (define_expand "tbegin_retry" - [(match_operand:SI 0 "register_operand" "=d") - (match_operand:BLK 1 "memory_operand" "=Q") - (match_operand 2 "const_int_operand")] + [(match_operand:SI 0 "register_operand" "") + (match_operand:BLK 1 "memory_operand" "") + (match_operand:SI 2 "general_operand" "")] "TARGET_HTM" { s390_expand_tbegin (operands[0], operands[1], operands[2], true); @@ -9885,9 +9885,9 @@ }) (define_expand "tbegin_retry_nofloat" - [(match_operand:SI 0 "register_operand" "=d") - (match_operand:BLK 1 "memory_operand" "=Q") - (match_operand 2 "const_int_operand")] + [(match_operand:SI 0 "register_operand" "") + (match_operand:BLK 1 "memory_operand" "") + (match_operand:SI 2 "general_operand" "")] "TARGET_HTM" { s390_expand_tbegin (operands[0], operands[1], operands[2], false); @@ -9954,7 +9954,7 @@ (define_expand "tend" [(set (reg:CCRAW CC_REGNUM) (unspec_volatile:CCRAW [(const_int 0)] UNSPECV_TEND)) - (set (match_operand:SI 0 "register_operand" "=d") + (set (match_operand:SI 0 "register_operand" "") (unspec:SI [(reg:CCRAW CC_REGNUM)] UNSPEC_CC_TO_INT))] "TARGET_HTM" "") @@ -9969,7 +9969,7 @@ ; Transaction abort (define_expand "tabort" - [(unspec_volatile [(match_operand 0 "shift_count_or_setmem_operand" "")] + [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "")] UNSPECV_TABORT)] "TARGET_HTM && operands != NULL" { @@ -9984,7 +9984,7 @@ }) (define_insn "*tabort_1" - [(unspec_volatile [(match_operand 0 "shift_count_or_setmem_operand" "")] + [(unspec_volatile [(match_operand:SI 0 "shift_count_or_setmem_operand" "Y")] UNSPECV_TABORT)] "TARGET_HTM && operands != NULL" "tabort\t%Y0" @@ -10013,7 +10013,7 @@ (define_expand "tx_assist" [(set (match_dup 1) (const_int 0)) - (unspec_volatile [(match_operand:SI 0 "register_operand" "d") + (unspec_volatile [(match_operand:SI 0 "register_operand" "") (match_dup 1) (const_int 1)] UNSPECV_PPA)] diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index eb7cdd4ff43..b6075b7cb90 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -14142,7 +14142,7 @@ depth is returned as integer value. For a nesting depth of 0 the code is not executed as part of an transaction. @end deftypefn -@deftypefn {Built-in Function} void __builtin_non_tx_store (unsigned long long *, unsigned long long) +@deftypefn {Built-in Function} void __builtin_non_tx_store (uint64_t *, uint64_t) Generates the @code{ntstg} machine instruction. The second argument is written to the first arguments location. The store operation will diff --git a/gcc/testsuite/gcc.target/s390/htm-1.c b/gcc/testsuite/gcc.target/s390/htm-1.c index e6321de071e..245ba2c7ef9 100644 --- a/gcc/testsuite/gcc.target/s390/htm-1.c +++ b/gcc/testsuite/gcc.target/s390/htm-1.c @@ -7,11 +7,12 @@ #include #include -int a = 0; +int global = 0; uint64_t g; +struct __htm_tdb global_tdb; int -foo (struct __htm_tdb* tdb) +foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t *mem64) { int cc; @@ -19,19 +20,54 @@ foo (struct __htm_tdb* tdb) cc = __builtin_tbegin (0); cc = __builtin_tbegin (tdb); + cc = __builtin_tbegin (&global_tdb); + cc = __builtin_tbegin_nofloat (0); - cc = __builtin_tbegin_nofloat (tdb); + cc = __builtin_tbegin_nofloat (&global_tdb); + cc = __builtin_tbegin_retry (0, 42); + cc = __builtin_tbegin_retry (0, reg); + cc = __builtin_tbegin_retry (0, *mem); + cc = __builtin_tbegin_retry (0, global); cc = __builtin_tbegin_retry (tdb, 42); + cc = __builtin_tbegin_retry (&global_tdb, 42); + cc = __builtin_tbegin_retry_nofloat (0, 42); - cc = __builtin_tbegin_retry_nofloat (tdb, 42); + cc = __builtin_tbegin_retry_nofloat (0, reg); + cc = __builtin_tbegin_retry_nofloat (0, *mem); + cc = __builtin_tbegin_retry_nofloat (0, global); + cc = __builtin_tbegin_retry_nofloat (&global_tdb, 42); + __builtin_tbeginc (); + n = __builtin_tx_nesting_depth(); - __builtin_non_tx_store(&g, n); + + __builtin_non_tx_store(&g, 23); + __builtin_non_tx_store(mem64, 23); + __builtin_non_tx_store(&g, reg); + __builtin_non_tx_store(&g, *mem); + __builtin_non_tx_store(&g, global); + __builtin_tabort (42 + 255); + __builtin_tabort (reg); + /* { dg-final { scan-assembler-times "tabort\t255" 1 } } */ + __builtin_tabort (reg + 255); + __builtin_tabort (*mem); + __builtin_tabort (global); + /* Here global + 255 gets reloaded into a reg. Better would be to + just reload global or *mem and get the +255 for free as address + arithmetic. */ + __builtin_tabort (*mem + 255); + __builtin_tabort (global + 255); + __builtin_tend(); + __builtin_tx_assist (23); + __builtin_tx_assist (reg); + __builtin_tx_assist (*mem); + __builtin_tx_assist (global); } + /* Make sure the tdb NULL argument ends up as immediate value in the instruction. */ -/* { dg-final { scan-assembler-times "tbegin\t0," 4 } } */ +/* { dg-final { scan-assembler-times "tbegin\t0," 10 } } */ -- cgit v1.2.3 From d39c42d63ad5e782c90ed501124f1cce6102316d Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Mon, 7 Oct 2013 07:47:17 +0000 Subject: 2013-10-07 Andreas Krebbel * config/s390/s390.c (s390_register_info): Make the call-saved FPR loop to work also for 31bit ABI. Save the stack pointer for frame_size > 0. 2013-10-07 Andreas Krebbel * gcc.target/s390/htm-nofloat-2.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203238 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 +++ gcc/config/s390/s390.c | 16 ++++---- gcc/testsuite/ChangeLog | 4 ++ gcc/testsuite/gcc.target/s390/htm-nofloat-2.c | 55 +++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/htm-nofloat-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b1fc0fe6d60..353f764c407 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-10-07 Andreas Krebbel + + * config/s390/s390.c (s390_register_info): Make the call-saved FPR + loop to work also for 31bit ABI. + Save the stack pointer for frame_size > 0. + 2013-10-07 Andreas Krebbel * config/s390/s390.md ("tbegin", "tbegin_nofloat", "tbegin_retry") diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 7b40bc1476b..273022778b4 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -7513,8 +7513,10 @@ s390_register_info (int clobbered_regs[]) { cfun_frame_layout.fpr_bitmap = 0; cfun_frame_layout.high_fprs = 0; - if (TARGET_64BIT) - for (i = 24; i < 32; i++) + for (i = 16; i <= 31; i++) + { + if (call_really_used_regs[i]) + continue; /* During reload we have to use the df_regs_ever_live infos since reload is marking FPRs used as spill slots there as live before actually making the code changes. Without @@ -7526,8 +7528,10 @@ s390_register_info (int clobbered_regs[]) && !global_regs[i]) { cfun_set_fpr_bit (i - 16); - cfun_frame_layout.high_fprs++; + if (i >= 24) + cfun_frame_layout.high_fprs++; } + } } for (i = 0; i < 16; i++) @@ -7557,6 +7561,7 @@ s390_register_info (int clobbered_regs[]) || TARGET_TPF_PROFILING || cfun_save_high_fprs_p || get_frame_size () > 0 + || (reload_completed && cfun_frame_layout.frame_size > 0) || cfun->calls_alloca || cfun->stdarg); @@ -7655,11 +7660,6 @@ s390_register_info (int clobbered_regs[]) cfun_set_fpr_bit (i); } } - - if (!TARGET_64BIT) - for (i = 2; i < 4; i++) - if (df_regs_ever_live_p (i + 16) && !global_regs[i + 16]) - cfun_set_fpr_bit (i); } /* Fill cfun->machine with info about frame of current function. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 09dd554bcfe..55182c2e2c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-07 Andreas Krebbel + + * gcc.target/s390/htm-nofloat-2.c: New testcase. + 2013-10-07 Andreas Krebbel Backport from mainline diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c new file mode 100644 index 00000000000..db9064284f9 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mhtm -Wa,-march=zEC12 --save-temps" } */ + +/* __builtin_tbegin has to emit clobbers for all FPRs since the tbegin + instruction does not automatically preserves them. If the + transaction body is fully contained in a function the backend tries + after reload to get rid of the FPR save/restore operations + triggered by the clobbers. This testcase failed since the backend + was able to get rid of all FPR saves/restores and since these were + the only stack operations also of the entire stack space. So even + the save/restore of the stack pointer was omitted in the end. + However, since the frame layout has been fixed before, the prologue + still generated the stack pointer decrement making foo return with + a modified stack pointer. */ + +void abort(void); + +void __attribute__((noinline)) +foo (int a) +{ + /* This is just to prevent the tbegin code from actually being + executed. That way the test may even run on machines prior to + zEC12. */ + if (a == 42) + return; + + if (__builtin_tbegin (0) == 0) + __builtin_tend (); +} + +#ifdef __s390x__ +#define GET_STACK_POINTER(SP) \ + asm volatile ("stg %%r15, %0" : "=QRST" (SP)); +#else +#define GET_STACK_POINTER(SP) \ + asm volatile ("st %%r15, %0" : "=QR" (SP)); +#endif + +int main(void) +{ + unsigned long new_sp, old_sp; + + GET_STACK_POINTER (old_sp); + foo(42); + GET_STACK_POINTER (new_sp); + + if (old_sp != new_sp) + abort (); + + return 0; +} + +/* Make sure no FPR saves/restores are emitted. */ +/* { dg-final { scan-assembler-not "\tstd\t" } } */ +/* { dg-final { scan-assembler-not "\tld\t" } } */ -- cgit v1.2.3 From 423066b41e6b1b00fd3a7aba737e260e5b78d04c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 7 Oct 2013 15:32:18 +0000 Subject: reflect: Use C style comments in 386 assembly for Solaris assembler. From Rainer Orth. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203250 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/reflect/makefunc_386.S | 47 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/libgo/go/reflect/makefunc_386.S b/libgo/go/reflect/makefunc_386.S index fb49281e2e3..5878bc44c56 100644 --- a/libgo/go/reflect/makefunc_386.S +++ b/libgo/go/reflect/makefunc_386.S @@ -1,12 +1,12 @@ -# Copyright 2013 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. +/* Copyright 2013 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. -# MakeFunc 386 assembly code. + MakeFunc 386 assembly code. */ #include "config.h" - .global reflect.makeFuncStub + .globl reflect.makeFuncStub #ifdef __ELF__ .type reflect.makeFuncStub,@function @@ -15,25 +15,26 @@ reflect.makeFuncStub: .LFB1: - # Go does not provide any equivalent to the regparm function - # attribute, so on Go we do not need to worry about passing - # parameters in registers. We just pass a pointer to the - # arguments on the stack. - # - # We do need to pick up the return values, though, so we pass - # a pointer to a struct that looks like this. - # struct { - # esp uint32 // 0x0 - # eax uint32 // 0x4 - # st0 uint64 // 0x8 - # } + /* Go does not provide any equivalent to the regparm function + attribute, so on Go we do not need to worry about passing + parameters in registers. We just pass a pointer to the + arguments on the stack. + + We do need to pick up the return values, though, so we pass + a pointer to a struct that looks like this. + struct { + esp uint32 // 0x0 + eax uint32 // 0x4 + st0 uint64 // 0x8 + } + */ pushl %ebp .LCFI0: movl %esp, %ebp .LCFI1: - pushl %ebx # In case this is PIC. - subl $36, %esp # Enough for args and to align stack. + pushl %ebx /* In case this is PIC. */ + subl $36, %esp /* Enough for args and to align stack. */ .LCFI2: #ifdef __PIC__ @@ -41,7 +42,7 @@ reflect.makeFuncStub: addl $_GLOBAL_OFFSET_TABLE_, %ebx #endif - leal 8(%ebp), %eax # Set esp field in struct. + leal 8(%ebp), %eax /* Set esp field in struct. */ movl %eax, -24(%ebp) #ifdef __PIC__ @@ -61,14 +62,14 @@ reflect.makeFuncStub: call reflect.MakeFuncStubGo #endif - # Set return registers. + /* Set return registers. */ movl -20(%ebp), %eax fldl -16(%ebp) #ifdef __SSE2__ - # In case we are compiling with -msseregparm. This won't work - # correctly if only SSE1 is supported, but that seems unlikely. + /* In case we are compiling with -msseregparm. This won't work + correctly if only SSE1 is supported, but that seems unlikely. */ movsd -16(%ebp), %xmm0 #endif -- cgit v1.2.3 From bebf82daccb22ae24236290d0597bb7230841f67 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 7 Oct 2013 23:21:58 +0000 Subject: PR libstdc++/57641 * include/std/mutex (timed_mutex, recursive_timed_mutex): Add overloaded _M_try_lock_until to handle conversion between different clocks. Replace constrained __try_lock_for_impl overloads with conditional increment. * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203256 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 9 ++ libstdc++-v3/include/std/mutex | 112 ++++++++++----------- .../30_threads/timed_mutex/try_lock_until/57641.cc | 69 +++++++++++++ 3 files changed, 134 insertions(+), 56 deletions(-) create mode 100644 libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ea7fcb77cb3..912a971620d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2013-10-07 Jonathan Wakely + + PR libstdc++/57641 + * include/std/mutex (timed_mutex, recursive_timed_mutex): Add + overloaded _M_try_lock_until to handle conversion between different + clocks. Replace constrained __try_lock_for_impl overloads with + conditional increment. + * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: New. + 2013-10-06 Jonathan Wakely PR libstdc++/57465 diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 67f34185deb..3093d9ac313 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -237,25 +237,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) - { return __try_lock_for_impl(__rtime); } + { return _M_try_lock_for(__rtime); } template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) - { - chrono::time_point<_Clock, chrono::seconds> __s = - chrono::time_point_cast(__atime); - - chrono::nanoseconds __ns = - chrono::duration_cast(__atime - __s); - - __gthread_time_t __ts = { - static_cast(__s.time_since_epoch().count()), - static_cast(__ns.count()) - }; - - return !__gthread_mutex_timedlock(&_M_mutex, &__ts); - } + { return _M_try_lock_until(__atime); } void unlock() @@ -270,26 +257,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: template - typename enable_if< - ratio_less_equal<__clock_t::period, _Period>::value, bool>::type - __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime) + bool + _M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { - __clock_t::time_point __atime = __clock_t::now() - + chrono::duration_cast<__clock_t::duration>(__rtime); + auto __rt = chrono::duration_cast<__clock_t::duration>(__rtime); + if (ratio_greater<__clock_t::period, _Period>()) + ++__rt; - return try_lock_until(__atime); + return _M_try_lock_until(__clock_t::now() + __rt); } - template - typename enable_if< - !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type - __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime) + template + bool + _M_try_lock_until(const chrono::time_point<__clock_t, + _Duration>& __atime) { - __clock_t::time_point __atime = __clock_t::now() - + ++chrono::duration_cast<__clock_t::duration>(__rtime); + chrono::time_point<__clock_t, chrono::seconds> __s = + chrono::time_point_cast(__atime); + + chrono::nanoseconds __ns = + chrono::duration_cast(__atime - __s); + + __gthread_time_t __ts = { + static_cast(__s.time_since_epoch().count()), + static_cast(__ns.count()) + }; - return try_lock_until(__atime); + return !__gthread_mutex_timedlock(native_handle(), &__ts); } + + template + bool + _M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) + { return _M_try_lock_for(__atime - _Clock::now()); } }; /// recursive_timed_mutex @@ -330,25 +330,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template bool try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) - { return __try_lock_for_impl(__rtime); } + { return _M_try_lock_for(__rtime); } template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) - { - chrono::time_point<_Clock, chrono::seconds> __s = - chrono::time_point_cast(__atime); - - chrono::nanoseconds __ns = - chrono::duration_cast(__atime - __s); - - __gthread_time_t __ts = { - static_cast(__s.time_since_epoch().count()), - static_cast(__ns.count()) - }; - - return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); - } + { return _M_try_lock_until(__atime); } void unlock() @@ -363,26 +350,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: template - typename enable_if< - ratio_less_equal<__clock_t::period, _Period>::value, bool>::type - __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime) + bool + _M_try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { - __clock_t::time_point __atime = __clock_t::now() - + chrono::duration_cast<__clock_t::duration>(__rtime); + auto __rt = chrono::duration_cast<__clock_t::duration>(__rtime); + if (ratio_greater<__clock_t::period, _Period>()) + ++__rt; - return try_lock_until(__atime); + return _M_try_lock_until(__clock_t::now() + __rt); } - template - typename enable_if< - !ratio_less_equal<__clock_t::period, _Period>::value, bool>::type - __try_lock_for_impl(const chrono::duration<_Rep, _Period>& __rtime) + template + bool + _M_try_lock_until(const chrono::time_point<__clock_t, + _Duration>& __atime) { - __clock_t::time_point __atime = __clock_t::now() - + ++chrono::duration_cast<__clock_t::duration>(__rtime); + chrono::time_point<__clock_t, chrono::seconds> __s = + chrono::time_point_cast(__atime); + + chrono::nanoseconds __ns = + chrono::duration_cast(__atime - __s); + + __gthread_time_t __ts = { + static_cast(__s.time_since_epoch().count()), + static_cast(__ns.count()) + }; - return try_lock_until(__atime); + return !__gthread_mutex_timedlock(native_handle(), &__ts); } + + template + bool + _M_try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) + { return _M_try_lock_for(__atime - _Clock::now()); } }; #endif #endif // _GLIBCXX_HAS_GTHREADS diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc new file mode 100644 index 00000000000..94fe5b32761 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc @@ -0,0 +1,69 @@ +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads-timed "" } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +// PR libstdc++/57641 + +namespace C = std::chrono; + +// custom clock with epoch 10s before system_clock's +struct clock +{ + typedef C::system_clock::rep rep; + typedef C::system_clock::period period; + typedef C::system_clock::duration duration; + typedef C::time_point time_point; + static constexpr bool is_steady = C::system_clock::is_steady; + + static time_point + now() + { + auto sys_time = C::system_clock::now().time_since_epoch(); + return time_point(sys_time + C::seconds(10)); + } +}; + +std::timed_mutex mx; +bool test = false; + +void f() +{ + test = mx.try_lock_until(clock::now() + C::milliseconds(1)); +} + +int main() +{ + bool test = false; + std::lock_guard l(mx); + auto start = C::system_clock::now(); + std::thread t(f); + t.join(); + auto stop = C::system_clock::now(); + VERIFY( (stop - start) < C::seconds(9) ); + VERIFY( !test ); +} -- cgit v1.2.3 From 9c918ae95c8e479a1025775bcde4948c0eeaf1ac Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 8 Oct 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203258 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index cab82776ebd..957548a2bbc 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131007 +20131008 -- cgit v1.2.3 From 96a32c80dafd735979e3f1b5286d4563f1d07d16 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 8 Oct 2013 13:35:30 +0000 Subject: 2013-10-08 Andreas Krebbel * gcc.target/s390/htm-nofloat-2.c: Add -mzarch to asm options. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203275 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/s390/htm-nofloat-2.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55182c2e2c8..fd87ac6ce89 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-08 Andreas Krebbel + + * gcc.target/s390/htm-nofloat-2.c: Add -mzarch to asm options. + 2013-10-07 Andreas Krebbel * gcc.target/s390/htm-nofloat-2.c: New testcase. diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c index db9064284f9..59621a4c19b 100644 --- a/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O3 -mhtm -Wa,-march=zEC12 --save-temps" } */ +/* { dg-options "-O3 -mhtm -Wa,-march=zEC12,-mzarch --save-temps" } */ /* __builtin_tbegin has to emit clobbers for all FPRs since the tbegin instruction does not automatically preserves them. If the -- cgit v1.2.3 From 75f73f56679d6f50d6520737f5af4bd2b8e5434d Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 8 Oct 2013 13:38:21 +0000 Subject: PR libstdc++/58659 * include/bits/shared_ptr_base.h (__shared_count::__shared_count(P,D)): Delegate to constructor taking allocator. (__shared_count::_S_create_from_up): Inline into ... (__shared_count::__shared_count(unique_ptr&&): Here. Use std::conditional instead of constrained overloads. Allocate memory using the allocator type that will be used for deallocation. * testsuite/20_util/shared_ptr/cons/58659.cc: New. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203277 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 12 ++++ libstdc++-v3/include/bits/shared_ptr_base.h | 69 +++++++--------------- .../testsuite/20_util/shared_ptr/cons/43820_neg.cc | 2 +- .../testsuite/20_util/shared_ptr/cons/58659.cc | 69 ++++++++++++++++++++++ 4 files changed, 102 insertions(+), 50 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 912a971620d..e8ae5f71345 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2013-10-08 Jonathan Wakely + + PR libstdc++/58659 + * include/bits/shared_ptr_base.h (__shared_count::__shared_count(P,D)): + Delegate to constructor taking allocator. + (__shared_count::_S_create_from_up): Inline into ... + (__shared_count::__shared_count(unique_ptr&&): Here. Use + std::conditional instead of constrained overloads. Allocate memory + using the allocator type that will be used for deallocation. + * testsuite/20_util/shared_ptr/cons/58659.cc: New. + * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust. + 2013-10-07 Jonathan Wakely PR libstdc++/57641 diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index c5df1fbcacc..5b0be418b53 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -459,29 +459,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0) - { - // The allocator's value_type doesn't matter, will rebind it anyway. - typedef std::allocator _Alloc; - typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type; - typedef typename allocator_traits<_Alloc>::template - rebind_traits<_Sp_cd_type> _Alloc_traits; - typename _Alloc_traits::allocator_type __a; - _Sp_cd_type* __mem = 0; - __try - { - __mem = _Alloc_traits::allocate(__a, 1); - _Alloc_traits::construct(__a, __mem, __p, std::move(__d)); - _M_pi = __mem; - } - __catch(...) - { - __d(__p); // Call _Deleter on __p. - if (__mem) - _Alloc_traits::deallocate(__a, __mem, 1); - __throw_exception_again; - } - } + __shared_count(_Ptr __p, _Deleter __d) + : __shared_count(__p, std::move(__d), allocator()) + { } template __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0) @@ -540,16 +520,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee. template explicit - __shared_count(std::unique_ptr<_Tp, _Del>&& __r) - : _M_pi(_S_create_from_up(std::move(__r))) - { __r.release(); } + __shared_count(std::unique_ptr<_Tp, _Del>&& __r) : _M_pi(0) + { + using _Ptr = typename unique_ptr<_Tp, _Del>::pointer; + using _Del2 = typename conditional::value, + reference_wrapper::type>, + _Del>::type; + using _Sp_cd_type + = _Sp_counted_deleter<_Ptr, _Del2, allocator, _Lp>; + using _Alloc = allocator<_Sp_cd_type>; + using _Alloc_traits = allocator_traits<_Alloc>; + _Alloc __a; + _Sp_cd_type* __mem = _Alloc_traits::allocate(__a, 1); + _Alloc_traits::construct(__a, __mem, __r.release(), + __r.get_deleter()); // non-throwing + _M_pi = __mem; + } // Throw bad_weak_ptr when __r._M_get_use_count() == 0. explicit __shared_count(const __weak_count<_Lp>& __r); ~__shared_count() noexcept { - if (_M_pi != 0) + if (_M_pi != nullptr) _M_pi->_M_release(); } @@ -611,28 +604,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION private: friend class __weak_count<_Lp>; - template - static _Sp_counted_base<_Lp>* - _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r, - typename std::enable_if::value>::type* = 0) - { - typedef typename unique_ptr<_Tp, _Del>::pointer _Ptr; - return new _Sp_counted_deleter<_Ptr, _Del, std::allocator, - _Lp>(__r.get(), __r.get_deleter()); - } - - template - static _Sp_counted_base<_Lp>* - _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r, - typename std::enable_if::value>::type* = 0) - { - typedef typename unique_ptr<_Tp, _Del>::pointer _Ptr; - typedef typename std::remove_reference<_Del>::type _Del1; - typedef std::reference_wrapper<_Del1> _Del2; - return new _Sp_counted_deleter<_Ptr, _Del2, std::allocator, - _Lp>(__r.get(), std::ref(__r.get_deleter())); - } - _Sp_counted_base<_Lp>* _M_pi; }; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc index 6fa34a9543b..e71fb4e2a27 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820_neg.cc @@ -32,7 +32,7 @@ void test01() { X* px = 0; std::shared_ptr p1(px); // { dg-error "here" } - // { dg-error "incomplete" "" { target *-*-* } 771 } + // { dg-error "incomplete" "" { target *-*-* } 742 } std::shared_ptr p9(ap()); // { dg-error "here" } // { dg-error "incomplete" "" { target *-*-* } 307 } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc new file mode 100644 index 00000000000..5e7c730e3ee --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +struct X { }; + +using spcd = std::_Sp_counted_deleter, +std::allocator, std::__default_lock_policy>; + +namespace std +{ + template<> + struct allocator + { + using value_type = spcd; + + allocator() = default; + + template + allocator(const allocator&) { } + + value_type* allocate(size_t n) + { + if (n != 1) + throw bad_alloc(); + allocated = true; + return static_cast((void*)(storage)); + } + + void deallocate(value_type* p, size_t n) + { + if (n != 1 || p != (void*)storage || !allocated) + abort(); + allocated = false; + } + + static char storage[sizeof(spcd)]; + static bool allocated; + }; + + char allocator::storage[]; + bool allocator::allocated = false; +} + +int main() +{ + std::shared_ptr s( std::unique_ptr(new X) ); + VERIFY( std::allocator::allocated ); + s.reset(); + VERIFY( !std::allocator::allocated ); +} -- cgit v1.2.3 From a0db6ea6a8a1311132be7d591073a8be592c5947 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 8 Oct 2013 22:29:49 +0000 Subject: /cp 2013-10-08 Paolo Carlini PR c++/58568 * semantics.c (begin_lambda_type): Check return value of xref_tag for error_mark_node; tidy. * decl.c (grokdeclarator): Tweak error message. /testsuite 2013-10-08 Paolo Carlini PR c++/58568 * g++.dg/cpp0x/lambda/lambda-ice10.C: New. * g++.old-deja/g++.mike/misc9.C: Adjust. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203290 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 4 ++-- gcc/cp/semantics.c | 4 ++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C | 8 ++++++++ gcc/testsuite/g++.old-deja/g++.mike/misc9.C | 2 +- 6 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 55d0408a80b..b01f2af9e54 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2013-10-08 Paolo Carlini + + PR c++/58568 + * semantics.c (begin_lambda_type): Check return value of xref_tag + for error_mark_node; tidy. + * decl.c (grokdeclarator): Tweak error message. + 2013-10-02 Paolo Carlini PR c++/58535 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index df979c2924b..893fbd161c5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8780,8 +8780,8 @@ grokdeclarator (const cp_declarator *declarator, && !uniquely_derived_from_p (ctype, current_class_type)) { - error ("type %qT is not derived from type %qT", - ctype, current_class_type); + error ("invalid use of qualified-name %<%T::%D%>", + qualifying_scope, decl); return error_mark_node; } } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5b8197e3dcb..580c609ac9c 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -9007,6 +9007,8 @@ begin_lambda_type (tree lambda) name, /*scope=*/ts_lambda, /*template_header_p=*/false); + if (type == error_mark_node) + return error_mark_node; } /* Designate it as a struct so that we can use aggregate initialization. */ @@ -9021,8 +9023,6 @@ begin_lambda_type (tree lambda) /* Start the class. */ type = begin_class_definition (type); - if (type == error_mark_node) - return error_mark_node; return type; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd87ac6ce89..7e26e84e34d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-10-08 Paolo Carlini + + PR c++/58568 + * g++.dg/cpp0x/lambda/lambda-ice10.C: New. + * g++.old-deja/g++.mike/misc9.C: Adjust. + 2013-10-08 Andreas Krebbel * gcc.target/s390/htm-nofloat-2.c: Add -mzarch to asm options. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C new file mode 100644 index 00000000000..1ea59c21c84 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice10.C @@ -0,0 +1,8 @@ +// PR c++/58568 +// { dg-do compile { target c++11 } } + +template struct A +{ + static const int i; + template const int A::i = []{ return 0; }(); // { dg-error "invalid use" } +}; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/misc9.C b/gcc/testsuite/g++.old-deja/g++.mike/misc9.C index 3d8858cf64a..7b9a86cbf4a 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/misc9.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/misc9.C @@ -8,6 +8,6 @@ class bee { class foo { public: - int bee::bar; // { dg-error "not derived" } you cannot do this + int bee::bar; // { dg-error "invalid use" } you cannot do this int me(); }; -- cgit v1.2.3 From df000695eb01068b8e978af73f4929a37f86bd4a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 8 Oct 2013 23:54:31 +0000 Subject: compiler: Error for qualified ID as field name in struct literal. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203293 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/expressions.cc | 41 +++++++++++++++++++++++++++++++++++----- gcc/go/gofrontend/expressions.h | 7 +++++-- gcc/go/gofrontend/parse.cc | 11 +++++++++-- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 13d4c1c789a..d5e3a67625a 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -11293,7 +11293,7 @@ Field_reference_expression::do_lower(Gogo* gogo, Named_object* function, } Expression* e = Expression::make_composite_literal(array_type, 0, false, - bytes, loc); + bytes, false, loc); Variable* var = new Variable(array_type, e, true, false, false, loc); @@ -13236,9 +13236,11 @@ class Composite_literal_expression : public Parser_expression { public: Composite_literal_expression(Type* type, int depth, bool has_keys, - Expression_list* vals, Location location) + Expression_list* vals, bool all_are_names, + Location location) : Parser_expression(EXPRESSION_COMPOSITE_LITERAL, location), - type_(type), depth_(depth), vals_(vals), has_keys_(has_keys) + type_(type), depth_(depth), vals_(vals), has_keys_(has_keys), + all_are_names_(all_are_names) { } protected: @@ -13256,6 +13258,7 @@ class Composite_literal_expression : public Parser_expression (this->vals_ == NULL ? NULL : this->vals_->copy()), + this->all_are_names_, this->location()); } @@ -13285,6 +13288,9 @@ class Composite_literal_expression : public Parser_expression // If this is true, then VALS_ is a list of pairs: a key and a // value. In an array initializer, a missing key will be NULL. bool has_keys_; + // If this is true, then HAS_KEYS_ is true, and every key is a + // simple identifier. + bool all_are_names_; }; // Traversal. @@ -13387,6 +13393,8 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) std::vector vals(field_count); std::vector* traverse_order = new(std::vector); Expression_list::const_iterator p = this->vals_->begin(); + Expression* external_expr = NULL; + const Named_object* external_no = NULL; while (p != this->vals_->end()) { Expression* name_expr = *p; @@ -13492,6 +13500,12 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) if (no != NULL) { + if (no->package() != NULL && external_expr == NULL) + { + external_expr = name_expr; + external_no = no; + } + name = no->name(); // A predefined name won't be packed. If it starts with a @@ -13541,6 +13555,23 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type) traverse_order->push_back(index); } + if (!this->all_are_names_) + { + // This is a weird case like bug462 in the testsuite. + if (external_expr == NULL) + error_at(this->location(), "unknown field in %qs literal", + (type->named_type() != NULL + ? type->named_type()->message_name().c_str() + : "unnamed struct")); + else + error_at(external_expr->location(), "unknown field %qs in %qs", + external_no->message_name().c_str(), + (type->named_type() != NULL + ? type->named_type()->message_name().c_str() + : "unnamed struct")); + return Expression::make_error(location); + } + Expression_list* list = new Expression_list; list->reserve(field_count); for (size_t i = 0; i < field_count; ++i) @@ -13830,11 +13861,11 @@ Composite_literal_expression::do_dump_expression( Expression* Expression::make_composite_literal(Type* type, int depth, bool has_keys, - Expression_list* vals, + Expression_list* vals, bool all_are_names, Location location) { return new Composite_literal_expression(type, depth, has_keys, vals, - location); + all_are_names, location); } // Return whether this expression is a composite literal. diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index b4cca5453b0..bc7a25f766a 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -291,10 +291,13 @@ class Expression make_unsafe_cast(Type*, Expression*, Location); // Make a composite literal. The DEPTH parameter is how far down we - // are in a list of composite literals with omitted types. + // are in a list of composite literals with omitted types. HAS_KEYS + // is true if the expression list has keys alternating with values. + // ALL_ARE_NAMES is true if all the keys could be struct field + // names. static Expression* make_composite_literal(Type*, int depth, bool has_keys, Expression_list*, - Location); + bool all_are_names, Location); // Make a struct composite literal. static Expression* diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index e68f1753f87..498125bb241 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -2690,15 +2690,17 @@ Parse::composite_lit(Type* type, int depth, Location location) { this->advance_token(); return Expression::make_composite_literal(type, depth, false, NULL, - location); + false, location); } bool has_keys = false; + bool all_are_names = true; Expression_list* vals = new Expression_list; while (true) { Expression* val; bool is_type_omitted = false; + bool is_name = false; const Token* token = this->peek_token(); @@ -2719,6 +2721,7 @@ Parse::composite_lit(Type* type, int depth, Location location) val = this->id_to_expression(gogo->pack_hidden_name(identifier, is_exported), location); + is_name = true; } else { @@ -2744,6 +2747,7 @@ Parse::composite_lit(Type* type, int depth, Location location) { if (has_keys) vals->push_back(NULL); + is_name = false; } else { @@ -2790,6 +2794,9 @@ Parse::composite_lit(Type* type, int depth, Location location) vals->push_back(val); + if (!is_name) + all_are_names = false; + if (token->is_op(OPERATOR_COMMA)) { if (this->advance_token()->is_op(OPERATOR_RCURLY)) @@ -2830,7 +2837,7 @@ Parse::composite_lit(Type* type, int depth, Location location) } return Expression::make_composite_literal(type, depth, has_keys, vals, - location); + all_are_names, location); } // FunctionLit = "func" Signature Block . -- cgit v1.2.3 From 67604a9cde7355cc22befa88808d8564f176bf0d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 9 Oct 2013 00:02:32 +0000 Subject: runtime: Do not report thunks and recover functions in backtrace. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203295 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-callers.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c index dd1cf7909b6..291dfd0d666 100644 --- a/libgo/runtime/go-callers.c +++ b/libgo/runtime/go-callers.c @@ -53,6 +53,21 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno, return 0; } + /* Skip thunks and recover functions. There is no equivalent to + these functions in the gc toolchain, so returning them here means + significantly different results for runtime.Caller(N). */ + if (function != NULL) + { + const char *p; + + p = __builtin_strchr (function, '.'); + if (p != NULL && __builtin_strncmp (p + 1, "$thunk", 6) == 0) + return 0; + p = __builtin_strrchr (function, '$'); + if (p != NULL && __builtin_strcmp(p, "$recover") == 0) + return 0; + } + if (arg->skip > 0) { --arg->skip; -- cgit v1.2.3 From 938c88c927160000c8ce43e7464f1be7d1098365 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 9 Oct 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203297 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 957548a2bbc..e3ee3c65f59 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131008 +20131009 -- cgit v1.2.3 From bbd41808410b35fea76f707e99686278066e893c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 9 Oct 2013 09:26:48 +0000 Subject: Backport from mainline 2013-09-26 Richard Biener PR tree-optimization/58539 * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor the fact that debug statements are not taking part in loop-closed SSA construction. * gcc.dg/torture/pr58539.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203307 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/torture/pr58539.c | 20 ++++++++++++++++++++ gcc/tree-vect-loop.c | 11 ++++++++--- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58539.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 353f764c407..85b2d693bbe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-10-09 Jakub Jelinek + + Backport from mainline + 2013-09-26 Richard Biener + + PR tree-optimization/58539 + * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor + the fact that debug statements are not taking part in loop-closed + SSA construction. + 2013-10-07 Andreas Krebbel * config/s390/s390.c (s390_register_info): Make the call-saved FPR diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e26e84e34d..71dbce15ce7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-10-09 Jakub Jelinek + + Backport from mainline + 2013-09-26 Richard Biener + + PR tree-optimization/58539 + * gcc.dg/torture/pr58539.c: New testcase. + 2013-10-08 Paolo Carlini PR c++/58568 diff --git a/gcc/testsuite/gcc.dg/torture/pr58539.c b/gcc/testsuite/gcc.dg/torture/pr58539.c new file mode 100644 index 00000000000..a016150f18e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58539.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +int a, b; + +extern void baz (int); + +int foo (int p) +{ + return p ? p : 1; +} + +void bar () +{ + int *c = &a, *d = &a; + for (b = 0; b < 12; b++) + *d |= 1; + foo (*c); + baz (*c && 1); +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 925b84832ef..ce531e13776 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4326,7 +4326,8 @@ vect_finalize_reduction: result. (The reduction result is expected to have two immediate uses - one at the latch block, and one at the loop exit). */ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest) - if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))) + if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))) + && !is_gimple_debug (USE_STMT (use_p))) phis.safe_push (USE_STMT (use_p)); /* While we expect to have found an exit_phi because of loop-closed-ssa @@ -4455,7 +4456,10 @@ vect_finalize_reduction: FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest) { if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))) - phis.safe_push (USE_STMT (use_p)); + { + if (!is_gimple_debug (USE_STMT (use_p))) + phis.safe_push (USE_STMT (use_p)); + } else { if (double_reduc && gimple_code (USE_STMT (use_p)) == GIMPLE_PHI) @@ -4465,7 +4469,8 @@ vect_finalize_reduction: FOR_EACH_IMM_USE_FAST (phi_use_p, phi_imm_iter, phi_res) { if (!flow_bb_inside_loop_p (loop, - gimple_bb (USE_STMT (phi_use_p)))) + gimple_bb (USE_STMT (phi_use_p))) + && !is_gimple_debug (USE_STMT (phi_use_p))) phis.safe_push (USE_STMT (phi_use_p)); } } -- cgit v1.2.3 From 768cdea9df04331fbfd77f3f6ccd0fbb25293239 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 9 Oct 2013 09:28:03 +0000 Subject: * parallel.c (GOMP_parallel_end): Remember team->nthreads and call gomp_team_end before adjusting gomp_remaining_threads_count, increment gomp_remaining_threads_count instead of decrementing it again. * testsuite/libgomp.c/thread-limit-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203308 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 7 +++++ libgomp/parallel.c | 11 +++++--- libgomp/testsuite/libgomp.c/thread-limit-1.c | 41 ++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 libgomp/testsuite/libgomp.c/thread-limit-1.c diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index af7a37a2b90..34ea133cf8d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,10 @@ +2013-10-09 Jakub Jelinek + + * parallel.c (GOMP_parallel_end): Remember team->nthreads and call + gomp_team_end before adjusting gomp_remaining_threads_count, increment + gomp_remaining_threads_count instead of decrementing it again. + * testsuite/libgomp.c/thread-limit-1.c: New test. + 2013-09-19 Jakub Jelinek * testsuite/libgomp.c/sections-2.c: New test. diff --git a/libgomp/parallel.c b/libgomp/parallel.c index 45735119025..2d5250a75e4 100644 --- a/libgomp/parallel.c +++ b/libgomp/parallel.c @@ -115,19 +115,22 @@ GOMP_parallel_end (void) { struct gomp_thread *thr = gomp_thread (); struct gomp_team *team = thr->ts.team; - if (team && team->nthreads > 1) + unsigned int nthreads = team ? team->nthreads : 1; + gomp_team_end (); + if (nthreads > 1) { #ifdef HAVE_SYNC_BUILTINS __sync_fetch_and_add (&gomp_remaining_threads_count, - 1UL - team->nthreads); + nthreads - 1); #else gomp_mutex_lock (&gomp_remaining_threads_lock); - gomp_remaining_threads_count -= team->nthreads - 1; + gomp_remaining_threads_count += nthreads - 1; gomp_mutex_unlock (&gomp_remaining_threads_lock); #endif } } - gomp_team_end (); + else + gomp_team_end (); } diff --git a/libgomp/testsuite/libgomp.c/thread-limit-1.c b/libgomp/testsuite/libgomp.c/thread-limit-1.c new file mode 100644 index 00000000000..6cc716bee89 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/thread-limit-1.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var OMP_THREAD_LIMIT "6" } */ + +#include +#include + +int +main () +{ + if (omp_get_thread_limit () != 6) + return 0; + omp_set_dynamic (0); + omp_set_nested (1); + #pragma omp parallel num_threads (3) + if (omp_get_num_threads () != 3) + abort (); + #pragma omp parallel num_threads (3) + if (omp_get_num_threads () != 3) + abort (); + #pragma omp parallel num_threads (8) + if (omp_get_num_threads () > 6) + abort (); + #pragma omp parallel num_threads (6) + if (omp_get_num_threads () != 6) + abort (); + int cnt = 0; + #pragma omp parallel num_threads (5) + #pragma omp parallel num_threads (5) + #pragma omp parallel num_threads (2) + { + int v; + #pragma omp atomic capture + v = ++cnt; + if (v > 6) + abort (); + usleep (10000); + #pragma omp atomic + --cnt; + } + return 0; +} -- cgit v1.2.3 From 735e4384ff2598556311c504386a34e3c9c7727c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Wed, 9 Oct 2013 18:39:21 +0000 Subject: * testsuite/20_util/shared_ptr/cons/58659.cc: Use VERIFY instead of aborting. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203326 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e8ae5f71345..c9ffe6ee858 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2013-10-09 Jonathan Wakely + + * testsuite/20_util/shared_ptr/cons/58659.cc: Use VERIFY instead of + aborting. + 2013-10-08 Jonathan Wakely PR libstdc++/58659 diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc index 5e7c730e3ee..9315796b240 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58659.cc @@ -47,8 +47,7 @@ namespace std void deallocate(value_type* p, size_t n) { - if (n != 1 || p != (void*)storage || !allocated) - abort(); + VERIFY(n == 1 && p == (void*)storage && allocated); allocated = false; } -- cgit v1.2.3 From be370f3025dd61dd7deba080e6974a8abd8398a8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 10 Oct 2013 00:16:42 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203334 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e3ee3c65f59..b84c5150194 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131009 +20131010 -- cgit v1.2.3 From c5eedf1713b79190cba88537bbfbb8c64d2de74e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 10 Oct 2013 16:39:52 +0000 Subject: PR middle-end/58670 * stmt.c (expand_asm_operands): Add FALLTHRU_BB argument, if any labels are in FALLTHRU_BB, use a special label emitted immediately after the asm goto insn rather than label_rtx of the LABEL_DECL. (expand_asm_stmt): Adjust caller. * cfgrtl.c (commit_one_edge_insertion): Force splitting of edge if the last insn in predecessor is a jump with single successor, but it isn't simplejump_p. * gcc.dg/torture/pr58670.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203384 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 +++++++++ gcc/cfgrtl.c | 12 +++++++-- gcc/stmt.c | 36 +++++++++++++++++++++++--- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/torture/pr58670.c | 47 ++++++++++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58670.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 85b2d693bbe..47410a2e880 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-10-10 Jakub Jelinek + + PR middle-end/58670 + * stmt.c (expand_asm_operands): Add FALLTHRU_BB argument, + if any labels are in FALLTHRU_BB, use a special label emitted + immediately after the asm goto insn rather than label_rtx + of the LABEL_DECL. + (expand_asm_stmt): Adjust caller. + * cfgrtl.c (commit_one_edge_insertion): Force splitting of + edge if the last insn in predecessor is a jump with single successor, + but it isn't simplejump_p. + 2013-10-09 Jakub Jelinek Backport from mainline diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index ec1ba9ad71c..1d1c6e7d811 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -1784,10 +1784,18 @@ commit_one_edge_insertion (edge e) } /* If the source has one successor and the edge is not abnormal, - insert there. Except for the entry block. */ + insert there. Except for the entry block. + Don't do this if the predecessor ends in a jump other than + unconditional simple jump. E.g. for asm goto that points all + its labels at the fallthru basic block, we can't insert instructions + before the asm goto, as the asm goto can have various of side effects, + and can't emit instructions after the asm goto, as it must end + the basic block. */ else if ((e->flags & EDGE_ABNORMAL) == 0 && single_succ_p (e->src) - && e->src != ENTRY_BLOCK_PTR) + && e->src != ENTRY_BLOCK_PTR + && (!JUMP_P (BB_END (e->src)) + || simplejump_p (BB_END (e->src)))) { bb = e->src; diff --git a/gcc/stmt.c b/gcc/stmt.c index ca58786c43c..7bdc9329bdf 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -613,6 +613,9 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs) CLOBBERS is a list of STRING_CST nodes each naming a hard register that is clobbered by this insn. + LABELS is a list of labels, and if LABELS is non-NULL, FALLTHRU_BB + should be the fallthru basic block of the asm goto. + Not all kinds of lvalue that may appear in OUTPUTS can be stored directly. Some elements of OUTPUTS may be replaced with trees representing temporary values. The caller should copy those temporary values to the originally @@ -622,7 +625,8 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs) static void expand_asm_operands (tree string, tree outputs, tree inputs, - tree clobbers, tree labels, int vol, location_t locus) + tree clobbers, tree labels, basic_block fallthru_bb, + int vol, location_t locus) { rtvec argvec, constraintvec, labelvec; rtx body; @@ -643,6 +647,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs, enum machine_mode *inout_mode = XALLOCAVEC (enum machine_mode, noutputs); const char **constraints = XALLOCAVEC (const char *, noutputs + ninputs); int old_generating_concat_p = generating_concat_p; + rtx fallthru_label = NULL_RTX; /* An ASM with no outputs needs to be treated as volatile, for now. */ if (noutputs == 0) @@ -942,8 +947,24 @@ expand_asm_operands (tree string, tree outputs, tree inputs, /* Copy labels to the vector. */ for (i = 0, tail = labels; i < nlabels; ++i, tail = TREE_CHAIN (tail)) - ASM_OPERANDS_LABEL (body, i) - = gen_rtx_LABEL_REF (Pmode, label_rtx (TREE_VALUE (tail))); + { + rtx r; + /* If asm goto has any labels in the fallthru basic block, use + a label that we emit immediately after the asm goto. Expansion + may insert further instructions into the same basic block after + asm goto and if we don't do this, insertion of instructions on + the fallthru edge might misbehave. See PR58670. */ + if (fallthru_bb + && label_to_block_fn (cfun, TREE_VALUE (tail)) == fallthru_bb) + { + if (fallthru_label == NULL_RTX) + fallthru_label = gen_label_rtx (); + r = fallthru_label; + } + else + r = label_rtx (TREE_VALUE (tail)); + ASM_OPERANDS_LABEL (body, i) = gen_rtx_LABEL_REF (Pmode, r); + } generating_concat_p = old_generating_concat_p; @@ -1067,6 +1088,9 @@ expand_asm_operands (tree string, tree outputs, tree inputs, emit_insn (body); } + if (fallthru_label) + emit_label (fallthru_label); + /* For any outputs that needed reloading into registers, spill them back to where they belong. */ for (i = 0; i < noutputs; ++i) @@ -1087,6 +1111,7 @@ expand_asm_stmt (gimple stmt) const char *s; tree str, out, in, cl, labels; location_t locus = gimple_location (stmt); + basic_block fallthru_bb = NULL; /* Meh... convert the gimple asm operands into real tree lists. Eventually we should make all routines work on the vectors instead @@ -1122,6 +1147,9 @@ expand_asm_stmt (gimple stmt) n = gimple_asm_nlabels (stmt); if (n > 0) { + edge fallthru = find_fallthru_edge (gimple_bb (stmt)->succs); + if (fallthru) + fallthru_bb = fallthru->dest; t = labels = gimple_asm_label_op (stmt, 0); for (i = 1; i < n; i++) t = TREE_CHAIN (t) = gimple_asm_label_op (stmt, i); @@ -1147,7 +1175,7 @@ expand_asm_stmt (gimple stmt) /* Generate the ASM_OPERANDS insn; store into the TREE_VALUEs of OUTPUTS some trees for where the values were actually stored. */ - expand_asm_operands (str, outputs, in, cl, labels, + expand_asm_operands (str, outputs, in, cl, labels, fallthru_bb, gimple_asm_volatile_p (stmt), locus); /* Copy all the intermediate outputs into the specified outputs. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71dbce15ce7..2d8fafc290c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-10 Jakub Jelinek + + PR middle-end/58670 + * gcc.dg/torture/pr58670.c: New test. + 2013-10-09 Jakub Jelinek Backport from mainline diff --git a/gcc/testsuite/gcc.dg/torture/pr58670.c b/gcc/testsuite/gcc.dg/torture/pr58670.c new file mode 100644 index 00000000000..e4536cc330f --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58670.c @@ -0,0 +1,47 @@ +/* PR middle-end/58670 */ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ + +#if defined (__i386__) || defined (__x86_64__) +#define ASM_STR "bts $1, %0; jc %l[lab]" +#endif + +__attribute__((noinline, noclone)) int +foo (int a, int b) +{ + if (a) + return -3; +#ifdef ASM_STR + asm volatile goto (ASM_STR : : "m" (b) : "memory" : lab); + return 0; +lab: +#endif + return 0; +} + +int +bar (int a, int b) +{ + if (a) + return -3; +#ifdef ASM_STR + asm volatile goto (ASM_STR : : "m" (b) : "memory" : lab); + return 0; +lab: +#endif + return 0; +} + +int +main () +{ + if (foo (1, 0) != -3 + || foo (0, 3) != 0 + || foo (1, 0) != -3 + || foo (0, 0) != 0 + || bar (1, 0) != -3 + || bar (0, 3) != 0 + || bar (1, 0) != -3 + || bar (0, 0) != 0) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 73985a3fdb0e064d1c0f35b4de9d5cb3f6d06353 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 11 Oct 2013 00:16:26 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203399 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index b84c5150194..d41284a4963 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131010 +20131011 -- cgit v1.2.3 From 9a02bd8a0d17c159133e9aec4ffdaee40a111668 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 12 Oct 2013 00:16:33 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203474 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d41284a4963..e1a60f9a2cb 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131011 +20131012 -- cgit v1.2.3 From 4d439e8777ac209d4bf7b9a1f1e5ded31831f0a3 Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Sat, 12 Oct 2013 08:23:31 +0000 Subject: Backport: [AArch64] Fix early-clobber operands to vtbx[1,3] * config/aarch64/arm_neon.h (vtbx<1,3>_8): Fix register constriants. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203480 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/aarch64/arm_neon.h | 12 ++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47410a2e880..c5ee5c8aa23 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-10-12 James Greenhalgh + + Backport from mainline. + 2013-10-12 James Greenhalgh + + * config/aarch64/arm_neon.h + (vtbx<1,3>_8): Fix register constriants. + 2013-10-10 Jakub Jelinek PR middle-end/58670 diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 60e1f7d438c..2bb42af72e4 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -19190,7 +19190,7 @@ vtbx1_s8 (int8x8_t r, int8x8_t tab, int8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {%2.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "w"(temp), "w"(idx), "w"(r) : /* No clobbers */); return result; @@ -19206,7 +19206,7 @@ vtbx1_u8 (uint8x8_t r, uint8x8_t tab, uint8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {%2.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "w"(temp), "w"(idx), "w"(r) : /* No clobbers */); return result; @@ -19222,7 +19222,7 @@ vtbx1_p8 (poly8x8_t r, poly8x8_t tab, uint8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {%2.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "w"(temp), "w"(idx), "w"(r) : /* No clobbers */); return result; @@ -19277,7 +19277,7 @@ vtbx3_s8 (int8x8_t r, int8x8x3_t tab, int8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {v16.16b - v17.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "Q"(temp), "w"(idx), "w"(r) : "v16", "v17", "memory"); return result; @@ -19296,7 +19296,7 @@ vtbx3_u8 (uint8x8_t r, uint8x8x3_t tab, uint8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {v16.16b - v17.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "Q"(temp), "w"(idx), "w"(r) : "v16", "v17", "memory"); return result; @@ -19315,7 +19315,7 @@ vtbx3_p8 (poly8x8_t r, poly8x8x3_t tab, uint8x8_t idx) "cmhs %0.8b, %3.8b, %0.8b\n\t" "tbl %1.8b, {v16.16b - v17.16b}, %3.8b\n\t" "bsl %0.8b, %4.8b, %1.8b\n\t" - : "+w"(result), "=w"(tmp1) + : "+w"(result), "=&w"(tmp1) : "Q"(temp), "w"(idx), "w"(r) : "v16", "v17", "memory"); return result; -- cgit v1.2.3 From 87de23d6f35d9f690756fcd183d07f6b38bc5c49 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 13 Oct 2013 00:16:39 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203494 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e1a60f9a2cb..565b53b2f2d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131012 +20131013 -- cgit v1.2.3 From bd14753389f3f3200ce7f9928c182331172a1b4d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 13 Oct 2013 14:58:57 +0000 Subject: * gcc-interface/decl.c (gnat_to_gnu_param): Remove obsolete comment. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203500 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/gcc-interface/decl.c | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1926fb7f9ed..05edeed6580 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2013-10-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_param): Remove obsolete comment. + 2013-09-18 Eric Botcazou PR ada/58264 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 5bdab9ddb49..5a68e8eaec4 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5763,12 +5763,8 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, ro_param || by_ref || by_component_ptr); DECL_BY_REF_P (gnu_param) = by_ref; DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr; - DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor || - mech == By_Short_Descriptor); - /* Note that, in case of a parameter passed by double reference, the - DECL_POINTS_TO_READONLY_P flag is meant for the second reference. - The first reference always points to read-only, as it points to - the second reference, i.e. the reference to the actual parameter. */ + DECL_BY_DESCRIPTOR_P (gnu_param) + = (mech == By_Descriptor || mech == By_Short_Descriptor); DECL_POINTS_TO_READONLY_P (gnu_param) = (ro_param && (by_ref || by_component_ptr)); DECL_CAN_NEVER_BE_NULL_P (gnu_param) = Can_Never_Be_Null (gnat_param); -- cgit v1.2.3 From b3b80be00c80ca100144777976310509b406eab6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 14 Oct 2013 00:16:20 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203510 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 565b53b2f2d..3e446dd4aca 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131013 +20131014 -- cgit v1.2.3 From 476eb0d69bf85b0ee60623c87fc6e1c965e7ff02 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Mon, 14 Oct 2013 12:58:43 +0000 Subject: Fix gcc.dg/torture/pr58670.c for Solaris 9/x86 assembler * gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]: Use btsl. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203535 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr58670.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2d8fafc290c..512d638c214 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-14 Rainer Orth + + * gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]: Use + btsl. + 2013-10-10 Jakub Jelinek PR middle-end/58670 diff --git a/gcc/testsuite/gcc.dg/torture/pr58670.c b/gcc/testsuite/gcc.dg/torture/pr58670.c index e4536cc330f..ba9fce71f9e 100644 --- a/gcc/testsuite/gcc.dg/torture/pr58670.c +++ b/gcc/testsuite/gcc.dg/torture/pr58670.c @@ -2,7 +2,7 @@ /* { dg-do run { target i?86-*-* x86_64-*-* } } */ #if defined (__i386__) || defined (__x86_64__) -#define ASM_STR "bts $1, %0; jc %l[lab]" +#define ASM_STR "btsl $1, %0; jc %l[lab]" #endif __attribute__((noinline, noclone)) int -- cgit v1.2.3 From 67188acae22cc2f961c6e4d698114350d49fa664 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 15 Oct 2013 00:16:41 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203581 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3e446dd4aca..57068b119d8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131014 +20131015 -- cgit v1.2.3 From 92dcf193775ada94af441a072790167dfd7706b7 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203637 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 57068b119d8..8c8fa238b2c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131015 +20131016 -- cgit v1.2.3 From cbfc10c972692fe3e200c67b03c15a88347f0493 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:17:46 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203641 138bc75d-0d04-0410-961f-82ee72b054a4 --- libada/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libada/ChangeLog b/libada/ChangeLog index 3189396bc15..5ea5f1cd967 100644 --- a/libada/ChangeLog +++ b/libada/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 5fc9d4bc8076379ee7ca2d5eb2ca5751d03eb258 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:17:49 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203642 138bc75d-0d04-0410-961f-82ee72b054a4 --- config/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/ChangeLog b/config/ChangeLog index c6af37a125b..33b7cf7ac65 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 3fd669df41546b199b36701a6c37b25fb295a727 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:17:53 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203643 138bc75d-0d04-0410-961f-82ee72b054a4 --- intl/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/intl/ChangeLog b/intl/ChangeLog index 9805d5ddb6d..2a0c547247c 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From f2762c5f599e71521a77408e3919deb0bfb70c12 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:17:56 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203644 138bc75d-0d04-0410-961f-82ee72b054a4 --- libffi/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libffi/ChangeLog b/libffi/ChangeLog index fe0453a4994..048d1fc9f52 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-06-25 Alan Modra * src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration -- cgit v1.2.3 From 2f2737956fcd64462a74bcee278af9b202de701e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:17:59 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203645 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index f75064e1def..25cd5cfbf90 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Rainer Orth Backport from mainline: -- cgit v1.2.3 From 716e48af2a51dbc72d5a0b89adf8d83c1e0a4026 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:03 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203646 138bc75d-0d04-0410-961f-82ee72b054a4 --- lto-plugin/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index 66e07b41bd9..01d1ed9b84a 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 94ed10803c6a8a61e90a521206373458e3bd929a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:07 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203647 138bc75d-0d04-0410-961f-82ee72b054a4 --- libquadmath/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog index cdca513b11f..449fea92699 100644 --- a/libquadmath/ChangeLog +++ b/libquadmath/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 42988a3cc060a5fb4a359a7c617871468f242991 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:11 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203648 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index a7f4a225b38..2701366be1e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-06-19 Matthias Klose * pkg.m4 (PKG_CHECK_MODULES): Use AC_PATH_TOOL to check for pkg-config. -- cgit v1.2.3 From 6c1cd8023e6eb23314d0721f8e139de9f6b527ef Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:15 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203649 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index 6831ade4e43..cb9966d95b6 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 11c562738589f01349d19f4e1d0bbbdab51b5198 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:18 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203650 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/libltdl/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog index d8df6fb18db..7ff264616cb 100644 --- a/libjava/libltdl/ChangeLog +++ b/libjava/libltdl/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 93c29e63c3debb30fd61ba7cdbff71034ad5a76d Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:22 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203651 138bc75d-0d04-0410-961f-82ee72b054a4 --- zlib/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zlib/ChangeLog b/zlib/ChangeLog index a886dbd2774..73bedd27b88 100644 --- a/zlib/ChangeLog +++ b/zlib/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 1bb094491b0bc92569e6cb8552b47620054a64fc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:25 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203652 138bc75d-0d04-0410-961f-82ee72b054a4 --- maintainer-scripts/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index f1404ad9876..82c25b3208f 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 0065d4a47cf2e1ac16032839b70e37d22fa5ced5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:28 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203653 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/config/libbid/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog index 3e25c4cadd1..c1f04e8458f 100644 --- a/libgcc/config/libbid/ChangeLog +++ b/libgcc/config/libbid/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 1e6d1cc5394d3d5e41802bb906045a057552ace2 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:32 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203654 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgcc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 4ef529f27b7..8aeac1ca1e5 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-08-01 Maxim Kuvyrkov Backport from trunk: Fix licenses on several libgcc files. -- cgit v1.2.3 From 30fed49ba3961d2bbf30ccf8254c4c56d05e7fec Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:35 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203655 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a20f5bb8092..cd7a210e56c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-04 Tobias Burnus PR fortran/55469 -- cgit v1.2.3 From 256d2a84abf1bac21068ddd12acdf8c4839c05ae Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:39 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203656 138bc75d-0d04-0410-961f-82ee72b054a4 --- libbacktrace/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index a7ea8c54aeb..5046ccbe136 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From c62df5143625574c57da617137d4fe91648eabec Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:42 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203657 138bc75d-0d04-0410-961f-82ee72b054a4 --- libatomic/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index 61643f1917a..b4492695bcf 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 4cd8133b68b0086779f9a7f59eed158f3a2626b0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:46 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203658 138bc75d-0d04-0410-961f-82ee72b054a4 --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0bc4cbb1c6e..5358ac27f6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-09-03 Richard Biener * configure.ac: Also allow ISL 0.12. -- cgit v1.2.3 From 52964725d583e3a8755d84c87f794c8f3b4e1a1c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:50 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203659 138bc75d-0d04-0410-961f-82ee72b054a4 --- libssp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libssp/ChangeLog b/libssp/ChangeLog index 385833ebf77..10dcb78a645 100644 --- a/libssp/ChangeLog +++ b/libssp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 679775be5b6b88acc98a4c6ddaa9dc6ffcdf74ca Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:54 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203660 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 34ea133cf8d..7a377b7d4c2 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-09 Jakub Jelinek * parallel.c (GOMP_parallel_end): Remember team->nthreads and call -- cgit v1.2.3 From 428a50f0cbd19a403aafafff004b43f1cbc389f6 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:18:57 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203661 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c9ffe6ee858..ee062c766c6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-09 Jonathan Wakely * testsuite/20_util/shared_ptr/cons/58659.cc: Use VERIFY instead of -- cgit v1.2.3 From 2d3924b7938feb735030d6ef8e89ef2c41594664 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:01 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203662 138bc75d-0d04-0410-961f-82ee72b054a4 --- libmudflap/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index 6336ffd14da..64800db427a 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From d520e01ee26c60a112245fbb9612a2668c40d280 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:04 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203663 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 543e24fb703..c50f73cc1d5 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 3a5ec99db4f90beb093dd14d1d9b342e35d1e499 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:08 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203664 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/po/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index fc7b0a6d47a..fab19320d38 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-03 Joseph Myers * sr.po: Update. -- cgit v1.2.3 From 3c449182aca24f7e02adaacd8959027c79e2776f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:13 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203665 138bc75d-0d04-0410-961f-82ee72b054a4 --- libobjc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index a775e42842a..feec5c9b8da 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-07-04 Kai Tietz * exception.c: Add check for SjLj to SEH blocks. -- cgit v1.2.3 From b62b85ca4cba12676f185c9c4a5a1a2c4995282b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:16 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203666 138bc75d-0d04-0410-961f-82ee72b054a4 --- libdecnumber/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index 8f6557bab1f..0d20380aa3f 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From da5ecc88bc0fa63ba616945e51978000ec6df4da Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:20 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203667 138bc75d-0d04-0410-961f-82ee72b054a4 --- boehm-gc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index fd7dfeb0b39..efb3eb86b44 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-09-04 Matthias Klose * Makefile.am (libgcjgc_la_LIBADD): Add EXTRA_TEST_LIBS. -- cgit v1.2.3 From a061b16ff5d90a98bb2549d1e3a6af8e9965467e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:23 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203668 138bc75d-0d04-0410-961f-82ee72b054a4 --- libiberty/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 34813eef9f7..df4c305d7e5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From d56a10ff01eada064bfd929185534f288c0b15e4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:27 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203669 138bc75d-0d04-0410-961f-82ee72b054a4 --- include/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ChangeLog b/include/ChangeLog index 9214e88ad1a..e854fd3d033 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From c81c94a64ac23e2d675f087151c1ffda193845b1 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:31 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203670 138bc75d-0d04-0410-961f-82ee72b054a4 --- gnattools/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog index d23ba167e99..9d32bb0f55b 100644 --- a/gnattools/ChangeLog +++ b/gnattools/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From ca5ea32b9157466188f1215f2159c45f2b8f9285 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:34 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203671 138bc75d-0d04-0410-961f-82ee72b054a4 --- libitm/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libitm/ChangeLog b/libitm/ChangeLog index 287bf737047..b71c0f8f729 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-08-14 Andreas Krebbel Revert: -- cgit v1.2.3 From f11d927fe23591f21959ed1563e42c08e7e2f90a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:38 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203672 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/reghunt/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/reghunt/ChangeLog b/contrib/reghunt/ChangeLog index b1429317b0d..e77d115e613 100644 --- a/contrib/reghunt/ChangeLog +++ b/contrib/reghunt/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From d4abe99ed0ccce8b7eab9dedf97c200c581bbe39 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:41 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203673 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 61a8390f106..5b38ad6614b 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 62506a77ceb914e112f7cdac6eba31c9804ea9f0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:45 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203674 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/regression/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/regression/ChangeLog b/contrib/regression/ChangeLog index 4c24e12006a..e3259f6c229 100644 --- a/contrib/regression/ChangeLog +++ b/contrib/regression/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 5f91be19de08759e8479191baffb91eff177f50a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:48 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203675 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 0a423810851..6c1504db518 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-04 Chris Manghane * go-gcc.cc (Backend::convert_expression): New function. -- cgit v1.2.3 From 37530b9cf5cafb2f5d3aaf7c828862921db93410 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:52 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203676 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 32410a3c3f9..e9449eee6b9 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From e88948b385d51d4b561e88db9f1903bb9a2dbdb8 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:19:55 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203677 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2f623b6b864..c8733a6d77e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-04 Tobias Burnus Backport from mainline -- cgit v1.2.3 From 4af6c3787a0c30a02da6c82b691a19afd8c0bb7b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:01 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203678 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b01f2af9e54..f6249680f35 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-08 Paolo Carlini PR c++/58568 -- cgit v1.2.3 From c62c3058f6c2804347e4c870a09ea4c015ba3546 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:05 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203679 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5ee5c8aa23..b8ece67d354 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-12 James Greenhalgh Backport from mainline. -- cgit v1.2.3 From 5c4de1225d2f6b70b45e48e5cdc4bbb54c2654a7 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:09 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203680 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index c0f24b85005..d16146f85e5 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From cd22e3b1b420026b15fbca9d053c01d782405f00 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:13 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203681 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/lto/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index d4ae0f9a87f..e179310f129 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 50359aa8609bc418539a1e66e8d79a5cce1039ed Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:16 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203682 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 05edeed6580..8f647a70864 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-13 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_param): Remove obsolete comment. -- cgit v1.2.3 From 249c83c9ddd7478c29df29e94cbc8ca98d60e0c4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:19 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203683 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 512d638c214..5a0b168ba64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-10-14 Rainer Orth * gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]: Use -- cgit v1.2.3 From 957a93b62c2c91d0c29cea48a95ad99e96a4aa98 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:23 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203684 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/objc/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 5d784dda2b4..508874cec3e 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From b779745e974c6d13facb1b6a006151c9e817b53a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:26 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index dd917ae1cca..794be14c412 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-08-09 Arnaud Charlet * c-ada-spec.c (print_ada_declaration): Prevent accessing null asm name -- cgit v1.2.3 From 53934aad16120bfcf3a21ca506f7c49d89fd1a79 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:30 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203686 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/po/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index 883bcc2f8a1..a01b6cbdc39 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-07-11 Joseph Myers * fi.po: Update. -- cgit v1.2.3 From e8d09628363c8eddc424666b9b7939f178d7b84a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:33 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203687 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/objcp/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog index 4d86a7d95b8..51c37e4a4f9 100644 --- a/gcc/objcp/ChangeLog +++ b/gcc/objcp/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From f54dd43ba8636a66ba866eeb6f1503cc125596ab Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:37 +0000 Subject: Mark ChangeLog git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203688 138bc75d-0d04-0410-961f-82ee72b054a4 --- libsanitizer/ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 7681a5a0834..11d22c0208b 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,7 @@ +2013-10-16 Release Manager + + * GCC 4.8.2 released. + 2013-05-31 Release Manager * GCC 4.8.1 released. -- cgit v1.2.3 From 2cd2bba931cedbb22526e650e881d941a4d0a049 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 16 Oct 2013 07:20:40 +0000 Subject: Mark as release git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203689 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DEV-PHASE | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/DEV-PHASE b/gcc/DEV-PHASE index 373fbc60bb9..e69de29bb2d 100644 --- a/gcc/DEV-PHASE +++ b/gcc/DEV-PHASE @@ -1 +0,0 @@ -prerelease -- cgit v1.2.3 From e9ea248217259e6db8be5632dabfa7d71b4f95fb Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 16 Oct 2013 09:33:10 +0000 Subject: * BASE-VER: Set to 4.8.3. * DEV-PHASE: Set to prerelease. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203692 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/BASE-VER | 2 +- gcc/ChangeLog | 5 +++++ gcc/DEV-PHASE | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 326ec6355f3..f99c6583c35 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -4.8.2 +4.8.3 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8ece67d354..17b09835217 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-10-16 Jakub Jelinek + + * BASE-VER: Set to 4.8.3. + * DEV-PHASE: Set to prerelease. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/DEV-PHASE b/gcc/DEV-PHASE index e69de29bb2d..373fbc60bb9 100644 --- a/gcc/DEV-PHASE +++ b/gcc/DEV-PHASE @@ -0,0 +1 @@ +prerelease -- cgit v1.2.3 From d23141f4ac22e5afcd8a3c9d560ef275c5e191d3 Mon Sep 17 00:00:00 2001 From: Ganesh Gopalasubramanian Date: Wed, 16 Oct 2013 10:47:13 +0000 Subject: Backport FMA4 enablement for bdver3 from mainline git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/config/i386/i386.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17b09835217..8e4bf656a55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-10-16 Ganesh Gopalasubramanian + + Backport from mainline + 2013-10-16 Ganesh Gopalasubramanian + + + * config/i386/i386.c (ix86_option_override_internal): Enable FMA4 + for AMD bdver3. + 2013-10-16 Jakub Jelinek * BASE-VER: Set to 4.8.3. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8475883823b..36bd80503f8 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2983,7 +2983,7 @@ ix86_option_override_internal (bool main_args_p) {"bdver3", PROCESSOR_BDVER3, CPU_BDVER3, PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_SSE4A | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 - | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX + | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_AVX | PTA_FMA4 | PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C | PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT}, -- cgit v1.2.3 From 8ce2e3f42d6747598e98285207cbe97d15e6ab6a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 16 Oct 2013 17:27:53 +0000 Subject: Bring over Go 1.1.2 bug fixes from mainline. Bring in from mainline: 2013-10-11 Chris Manghane * go-gcc.cc (Gcc_backend::function_code_expression): New function. 2013-10-10 Chris Manghane * go-gcc.cc (Backend::error_function): New function. (Backend::function): New function. (Backend::make_function): New function. (function_to_tree): New function. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203712 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/ChangeLog | 14 ++ gcc/go/go-gcc.cc | 87 ++++++++++++ gcc/go/gofrontend/backend.h | 34 ++++- gcc/go/gofrontend/expressions.cc | 153 ++++++++++++++++---- gcc/go/gofrontend/expressions.h | 4 +- gcc/go/gofrontend/gogo-tree.cc | 300 +++++++-------------------------------- gcc/go/gofrontend/gogo.cc | 147 ++++++++++++++++++- gcc/go/gofrontend/gogo.h | 39 +++-- gcc/go/gofrontend/import.h | 5 + gcc/go/gofrontend/lex.cc | 23 ++- gcc/go/gofrontend/parse.cc | 2 + gcc/go/gofrontend/runtime.cc | 7 + gcc/go/gofrontend/runtime.def | 6 + gcc/go/gofrontend/types.cc | 134 ++++++++++------- gcc/go/gofrontend/types.h | 11 +- libgo/Makefile.am | 1 + libgo/Makefile.in | 11 +- libgo/runtime/go-cdiv.c | 46 ++++++ libgo/runtime/go-make-slice.c | 5 +- libgo/runtime/go-signal.c | 7 +- 20 files changed, 676 insertions(+), 360 deletions(-) create mode 100644 libgo/runtime/go-cdiv.c diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 6c1504db518..416d9235551 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,17 @@ +2013-10-16 Ian Lance Taylor + + Bring in from mainline: + + 2013-10-11 Chris Manghane + * go-gcc.cc (Gcc_backend::function_code_expression): New + function. + + 2013-10-10 Chris Manghane + * go-gcc.cc (Backend::error_function): New function. + (Backend::function): New function. + (Backend::make_function): New function. + (function_to_tree): New function. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index fcfd41b34ab..81e9ad18610 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -232,6 +232,9 @@ class Gcc_backend : public Backend Bexpression* convert_expression(Btype* type, Bexpression* expr, Location); + Bexpression* + function_code_expression(Bfunction*, Location); + // Statements. Bstatement* @@ -334,6 +337,17 @@ class Gcc_backend : public Backend Bexpression* label_address(Blabel*, Location); + // Functions. + + Bfunction* + error_function() + { return this->make_function(error_mark_node); } + + Bfunction* + function(Btype* fntype, const std::string& name, const std::string& asm_name, + bool is_visible, bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, Location); + private: // Make a Bexpression from a tree. Bexpression* @@ -350,6 +364,10 @@ class Gcc_backend : public Backend make_type(tree t) { return new Btype(t); } + Bfunction* + make_function(tree t) + { return new Bfunction(t); } + Btype* fill_in_struct(Btype*, const std::vector&); @@ -966,6 +984,19 @@ Gcc_backend::convert_expression(Btype* type, Bexpression* expr, Location) return tree_to_expr(ret); } +// Get the address of a function. + +Bexpression* +Gcc_backend::function_code_expression(Bfunction* bfunc, Location location) +{ + tree func = bfunc->get_tree(); + if (func == error_mark_node) + return this->error_expression(); + + tree ret = build_fold_addr_expr_loc(location.gcc_location(), func); + return this->make_expression(ret); +} + // An expression as a statement. Bstatement* @@ -1724,6 +1755,56 @@ Gcc_backend::label_address(Blabel* label, Location location) return this->make_expression(ret); } +// Declare or define a new function. + +Bfunction* +Gcc_backend::function(Btype* fntype, const std::string& name, + const std::string& asm_name, bool is_visible, + bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, + Location location) +{ + tree functype = fntype->get_tree(); + if (functype != error_mark_node) + { + gcc_assert(FUNCTION_POINTER_TYPE_P(functype)); + functype = TREE_TYPE(functype); + } + tree id = get_identifier_from_string(name); + if (functype == error_mark_node || id == error_mark_node) + return this->error_function(); + + tree decl = build_decl(location.gcc_location(), FUNCTION_DECL, id, functype); + if (!asm_name.empty()) + SET_DECL_ASSEMBLER_NAME(decl, get_identifier_from_string(asm_name)); + if (is_visible) + TREE_PUBLIC(decl) = 1; + if (is_declaration) + DECL_EXTERNAL(decl) = 1; + else + { + tree restype = TREE_TYPE(functype); + tree resdecl = + build_decl(location.gcc_location(), RESULT_DECL, NULL_TREE, restype); + DECL_ARTIFICIAL(resdecl) = 1; + DECL_IGNORED_P(resdecl) = 1; + DECL_CONTEXT(resdecl) = decl; + DECL_RESULT(decl) = resdecl; + } + if (!is_inlinable) + DECL_UNINLINABLE(decl) = 1; + if (disable_split_stack) + { + tree attr = get_identifier("__no_split_stack__"); + DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); + } + if (in_unique_section) + resolve_unique_section(decl, 0, 1); + + go_preserve_from_gc(decl); + return new Bfunction(decl); +} + // The single backend. static Gcc_backend gcc_backend; @@ -1799,3 +1880,9 @@ var_to_tree(Bvariable* bv) { return bv->get_tree(); } + +tree +function_to_tree(Bfunction* bf) +{ + return bf->get_tree(); +} diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h index fa3e3cc6893..ca997f08ade 100644 --- a/gcc/go/gofrontend/backend.h +++ b/gcc/go/gofrontend/backend.h @@ -23,7 +23,7 @@ class Bexpression; // The backend representation of a statement. class Bstatement; -// The backend representation of a function definition. +// The backend representation of a function definition or declaration. class Bfunction; // The backend representation of a block. @@ -266,6 +266,11 @@ class Backend virtual Bexpression* convert_expression(Btype* type, Bexpression* expr, Location) = 0; + // Create an expression for the address of a function. This is used to + // get the address of the code for a function. + virtual Bexpression* + function_code_expression(Bfunction*, Location) = 0; + // Statements. // Create an error statement. This is used for cases which should @@ -498,6 +503,32 @@ class Backend // recover. virtual Bexpression* label_address(Blabel*, Location) = 0; + + // Functions. + + // Create an error function. This is used for cases which should + // not occur in a correct program, in order to keep the compilation + // going without crashing. + virtual Bfunction* + error_function() = 0; + + // Declare or define a function of FNTYPE. + // NAME is the Go name of the function. ASM_NAME, if not the empty string, is + // the name that should be used in the symbol table; this will be non-empty if + // a magic extern comment is used. + // IS_VISIBLE is true if this function should be visible outside of the + // current compilation unit. IS_DECLARATION is true if this is a function + // declaration rather than a definition; the function definition will be in + // another compilation unit. + // IS_INLINABLE is true if the function can be inlined. + // DISABLE_SPLIT_STACK is true if this function may not split the stack; this + // is used for the implementation of recover. + // IN_UNIQUE_SECTION is true if this function should be put into a unique + // location if possible; this is used for field tracking. + virtual Bfunction* + function(Btype* fntype, const std::string& name, const std::string& asm_name, + bool is_visible, bool is_declaration, bool is_inlinable, + bool disable_split_stack, bool in_unique_section, Location) = 0; }; // The backend interface has to define this function. @@ -517,5 +548,6 @@ extern tree expr_to_tree(Bexpression*); extern tree stat_to_tree(Bstatement*); extern tree block_to_tree(Bblock*); extern tree var_to_tree(Bvariable*); +extern tree function_to_tree(Bfunction*); #endif // !defined(GO_BACKEND_H) diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index d5e3a67625a..6ba351e2f42 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1219,7 +1219,7 @@ Func_expression::do_type() // Get the tree for the code of a function expression. -tree +Bexpression* Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc) { Function_type* fntype; @@ -1237,25 +1237,18 @@ Func_expression::get_code_pointer(Gogo* gogo, Named_object* no, Location loc) error_at(loc, "invalid use of special builtin function %qs; must be called", no->message_name().c_str()); - return error_mark_node; + return gogo->backend()->error_expression(); } - tree id = no->get_id(gogo); - if (id == error_mark_node) - return error_mark_node; - - tree fndecl; + Bfunction* fndecl; if (no->is_function()) - fndecl = no->func_value()->get_or_make_decl(gogo, no, id); + fndecl = no->func_value()->get_or_make_decl(gogo, no); else if (no->is_function_declaration()) - fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no, id); + fndecl = no->func_declaration_value()->get_or_make_decl(gogo, no); else go_unreachable(); - if (fndecl == error_mark_node) - return error_mark_node; - - return build_fold_addr_expr_loc(loc.gcc_location(), fndecl); + return gogo->backend()->function_code_expression(fndecl, loc); } // Get the tree for a function expression. This is used when we take @@ -1492,8 +1485,10 @@ class Func_code_reference_expression : public Expression tree Func_code_reference_expression::do_get_tree(Translate_context* context) { - return Func_expression::get_code_pointer(context->gogo(), this->function_, - this->location()); + Bexpression* ret = + Func_expression::get_code_pointer(context->gogo(), this->function_, + this->location()); + return expr_to_tree(ret); } // Make a reference to the code of a function. @@ -3055,8 +3050,7 @@ class Type_conversion_expression : public Expression do_lower(Gogo*, Named_object*, Statement_inserter*, int); bool - do_is_constant() const - { return this->expr_->is_constant(); } + do_is_constant() const; bool do_numeric_constant_value(Numeric_constant*) const; @@ -3198,6 +3192,27 @@ Type_conversion_expression::do_lower(Gogo*, Named_object*, return this; } +// Return whether a type conversion is a constant. + +bool +Type_conversion_expression::do_is_constant() const +{ + if (!this->expr_->is_constant()) + return false; + + // A conversion to a type that may not be used as a constant is not + // a constant. For example, []byte(nil). + Type* type = this->type_; + if (type->integer_type() == NULL + && type->float_type() == NULL + && type->complex_type() == NULL + && !type->is_boolean_type() + && !type->is_string_type()) + return false; + + return true; +} + // Return the constant numeric value if there is one. bool @@ -5586,6 +5601,15 @@ Binary_expression::do_determine_type(const Type_context* context) subcontext.type = NULL; } + if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR) + { + // For a logical operation, the context does not determine the + // types of the operands. The operands must be some boolean + // type but if the context has a boolean type they do not + // inherit it. See http://golang.org/issue/3924. + subcontext.type = NULL; + } + // Set the context for the left hand operand. if (is_shift_op) { @@ -5967,6 +5991,43 @@ Binary_expression::do_get_tree(Translate_context* context) right); } + // For complex division Go wants slightly different results than the + // GCC library provides, so we have our own runtime routine. + if (this->op_ == OPERATOR_DIV && this->left_->type()->complex_type() != NULL) + { + const char *name; + tree *pdecl; + Type* ctype; + static tree complex64_div_decl; + static tree complex128_div_decl; + switch (this->left_->type()->complex_type()->bits()) + { + case 64: + name = "__go_complex64_div"; + pdecl = &complex64_div_decl; + ctype = Type::lookup_complex_type("complex64"); + break; + case 128: + name = "__go_complex128_div"; + pdecl = &complex128_div_decl; + ctype = Type::lookup_complex_type("complex128"); + break; + default: + go_unreachable(); + } + Btype* cbtype = ctype->get_backend(gogo); + tree ctype_tree = type_to_tree(cbtype); + return Gogo::call_builtin(pdecl, + this->location(), + name, + 2, + ctype_tree, + ctype_tree, + fold_convert_loc(gccloc, ctype_tree, left), + type, + fold_convert_loc(gccloc, ctype_tree, right)); + } + tree compute_type = excess_precision_type(type); if (compute_type != NULL_TREE) { @@ -7191,6 +7252,15 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, if (this->code_ == BUILTIN_OFFSETOF) { Expression* arg = this->one_arg(); + + if (arg->bound_method_expression() != NULL + || arg->interface_field_reference_expression() != NULL) + { + this->report_error(_("invalid use of method value as argument " + "of Offsetof")); + return this; + } + Field_reference_expression* farg = arg->field_reference_expression(); while (farg != NULL) { @@ -7200,7 +7270,8 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, // it must not be reached through pointer indirections. if (farg->expr()->deref() != farg->expr()) { - this->report_error(_("argument of Offsetof implies indirection of an embedded field")); + this->report_error(_("argument of Offsetof implies " + "indirection of an embedded field")); return this; } // Go up until we reach the original base. @@ -7476,7 +7547,7 @@ Builtin_call_expression::check_int_value(Expression* e, bool is_length) switch (nc.to_unsigned_long(&v)) { case Numeric_constant::NC_UL_VALID: - return true; + break; case Numeric_constant::NC_UL_NOTINT: error_at(e->location(), "non-integer %s argument to make", is_length ? "len" : "cap"); @@ -7488,8 +7559,23 @@ Builtin_call_expression::check_int_value(Expression* e, bool is_length) case Numeric_constant::NC_UL_BIG: // We don't want to give a compile-time error for a 64-bit // value on a 32-bit target. - return true; + break; + } + + mpz_t val; + if (!nc.to_int(&val)) + go_unreachable(); + int bits = mpz_sizeinbase(val, 2); + mpz_clear(val); + Type* int_type = Type::lookup_integer_type("int"); + if (bits >= int_type->integer_type()->bits()) + { + error_at(e->location(), "%s argument too large for make", + is_length ? "len" : "cap"); + return false; } + + return true; } if (e->type()->integer_type() != NULL) @@ -7595,6 +7681,8 @@ Find_call_expression::expression(Expression** pexpr) bool Builtin_call_expression::do_is_constant() const { + if (this->is_error_expression()) + return true; switch (this->code_) { case BUILTIN_LEN: @@ -9744,14 +9832,8 @@ Call_expression::do_get_tree(Translate_context* context) } tree fntype_tree = type_to_tree(fntype->get_backend(gogo)); - if (fntype_tree == error_mark_node) - return error_mark_node; - go_assert(POINTER_TYPE_P(fntype_tree)); - if (TREE_TYPE(fntype_tree) == error_mark_node) - return error_mark_node; - go_assert(TREE_CODE(TREE_TYPE(fntype_tree)) == RECORD_TYPE); - tree fnfield_type = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(fntype_tree))); - if (fnfield_type == error_mark_node) + tree fnfield_type = type_to_tree(fntype->get_backend_fntype(gogo)); + if (fntype_tree == error_mark_node || fnfield_type == error_mark_node) return error_mark_node; go_assert(FUNCTION_POINTER_TYPE_P(fnfield_type)); tree rettype = TREE_TYPE(TREE_TYPE(fnfield_type)); @@ -9763,7 +9845,7 @@ Call_expression::do_get_tree(Translate_context* context) if (func != NULL) { Named_object* no = func->named_object(); - fn = Func_expression::get_code_pointer(gogo, no, location); + fn = expr_to_tree(Func_expression::get_code_pointer(gogo, no, location)); if (!has_closure) closure_tree = NULL_TREE; else @@ -10817,11 +10899,20 @@ String_index_expression::do_determine_type(const Type_context*) void String_index_expression::do_check_types(Gogo*) { - if (this->start_->type()->integer_type() == NULL) + Numeric_constant nc; + unsigned long v; + if (this->start_->type()->integer_type() == NULL + && !this->start_->type()->is_error() + && (!this->start_->numeric_constant_value(&nc) + || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) this->report_error(_("index must be integer")); if (this->end_ != NULL && this->end_->type()->integer_type() == NULL - && !this->end_->is_nil_expression()) + && !this->end_->type()->is_error() + && !this->end_->is_nil_expression() + && !this->end_->is_error_expression() + && (!this->end_->numeric_constant_value(&nc) + || nc.to_unsigned_long(&v) == Numeric_constant::NC_UL_NOTINT)) this->report_error(_("slice end must be integer")); std::string sval; diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index bc7a25f766a..35bfcfe8e4f 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -1514,8 +1514,8 @@ class Func_expression : public Expression closure() { return this->closure_; } - // Return a tree for the code for a function. - static tree + // Return a backend expression for the code of a function. + static Bexpression* get_code_pointer(Gogo*, Named_object* function, Location loc); protected: diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index a95f2901509..ca80869da6a 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -985,74 +985,6 @@ Gogo::write_globals() delete[] vec; } -// Get a tree for the identifier for a named object. - -tree -Named_object::get_id(Gogo* gogo) -{ - go_assert(!this->is_variable() && !this->is_result_variable()); - std::string decl_name; - if (this->is_function_declaration() - && !this->func_declaration_value()->asm_name().empty()) - decl_name = this->func_declaration_value()->asm_name(); - else if (this->is_type() - && Linemap::is_predeclared_location(this->type_value()->location())) - { - // We don't need the package name for builtin types. - decl_name = Gogo::unpack_hidden_name(this->name_); - } - else - { - std::string package_name; - if (this->package_ == NULL) - package_name = gogo->package_name(); - else - package_name = this->package_->package_name(); - - // Note that this will be misleading if this is an unexported - // method generated for an embedded imported type. In that case - // the unexported method should have the package name of the - // package from which it is imported, but we are going to give - // it our package name. Fixing this would require knowing the - // package name, but we only know the package path. It might be - // better to use package paths here anyhow. This doesn't affect - // the assembler code, because we always set that name in - // Function::get_or_make_decl anyhow. FIXME. - - decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); - - Function_type* fntype; - if (this->is_function()) - fntype = this->func_value()->type(); - else if (this->is_function_declaration()) - fntype = this->func_declaration_value()->type(); - else - fntype = NULL; - if (fntype != NULL && fntype->is_method()) - { - decl_name.push_back('.'); - decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); - } - } - if (this->is_type()) - { - unsigned int index; - const Named_object* in_function = this->type_value()->in_function(&index); - if (in_function != NULL) - { - decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); - if (index > 0) - { - char buf[30]; - snprintf(buf, sizeof buf, "%u", index); - decl_name += '$'; - decl_name += buf; - } - } - } - return get_identifier_from_string(decl_name); -} - // Get a tree for a named object. tree @@ -1067,11 +999,6 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) return error_mark_node; } - tree name; - if (this->classification_ == NAMED_OBJECT_TYPE) - name = NULL_TREE; - else - name = this->get_id(gogo); tree decl; switch (this->classification_) { @@ -1099,6 +1026,7 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) decl = error_mark_node; else if (INTEGRAL_TYPE_P(TREE_TYPE(expr_tree))) { + tree name = get_identifier_from_string(this->get_id(gogo)); decl = build_decl(named_constant->location().gcc_location(), CONST_DECL, name, TREE_TYPE(expr_tree)); DECL_INITIAL(decl) = expr_tree; @@ -1161,7 +1089,7 @@ Named_object::get_tree(Gogo* gogo, Named_object* function) case NAMED_OBJECT_FUNC: { Function* func = this->u_.func_value; - decl = func->get_or_make_decl(gogo, this, name); + decl = function_to_tree(func->get_or_make_decl(gogo, this)); if (decl != error_mark_node) { if (func->block() != NULL) @@ -1286,123 +1214,12 @@ Variable::get_init_block(Gogo* gogo, Named_object* function, tree var_decl) return block_tree; } -// Get a tree for a function decl. +// Get the backend representation. -tree -Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) +Bfunction* +Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no) { - if (this->fndecl_ == NULL_TREE) - { - tree functype = type_to_tree(this->type_->get_backend(gogo)); - - if (functype != error_mark_node) - { - // The type of a function comes back as a pointer to a - // struct whose first field is the function, but we want the - // real function type for a function declaration. - go_assert(POINTER_TYPE_P(functype) - && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); - functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); - go_assert(FUNCTION_POINTER_TYPE_P(functype)); - functype = TREE_TYPE(functype); - } - - if (functype == error_mark_node) - this->fndecl_ = error_mark_node; - else - { - tree decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, - id, functype); - - this->fndecl_ = decl; - - if (no->package() != NULL) - ; - else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) - ; - else if (Gogo::unpack_hidden_name(no->name()) == "init" - && !this->type_->is_method()) - ; - else if (Gogo::unpack_hidden_name(no->name()) == "main" - && gogo->is_main_package()) - TREE_PUBLIC(decl) = 1; - // Methods have to be public even if they are hidden because - // they can be pulled into type descriptors when using - // anonymous fields. - else if (!Gogo::is_hidden_name(no->name()) - || this->type_->is_method()) - { - TREE_PUBLIC(decl) = 1; - std::string pkgpath = gogo->pkgpath_symbol(); - if (this->type_->is_method() - && Gogo::is_hidden_name(no->name()) - && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) - { - // This is a method we created for an unexported - // method of an imported embedded type. We need to - // use the pkgpath of the imported package to avoid - // a possible name collision. See bug478 for a test - // case. - pkgpath = Gogo::hidden_name_pkgpath(no->name()); - pkgpath = Gogo::pkgpath_for_symbol(pkgpath); - } - - std::string asm_name = pkgpath; - asm_name.append(1, '.'); - asm_name.append(Gogo::unpack_hidden_name(no->name())); - if (this->type_->is_method()) - { - asm_name.append(1, '.'); - Type* rtype = this->type_->receiver()->type(); - asm_name.append(rtype->mangled_name(gogo)); - } - SET_DECL_ASSEMBLER_NAME(decl, - get_identifier_from_string(asm_name)); - } - - // Why do we have to do this in the frontend? - tree restype = TREE_TYPE(functype); - tree resdecl = - build_decl(this->location().gcc_location(), RESULT_DECL, NULL_TREE, - restype); - DECL_ARTIFICIAL(resdecl) = 1; - DECL_IGNORED_P(resdecl) = 1; - DECL_CONTEXT(resdecl) = decl; - DECL_RESULT(decl) = resdecl; - - // If a function calls the predeclared recover function, we - // can't inline it, because recover behaves differently in a - // function passed directly to defer. If this is a recover - // thunk that we built to test whether a function can be - // recovered, we can't inline it, because that will mess up - // our return address comparison. - if (this->calls_recover_ || this->is_recover_thunk_) - DECL_UNINLINABLE(decl) = 1; - - // If this is a thunk created to call a function which calls - // the predeclared recover function, we need to disable - // stack splitting for the thunk. - if (this->is_recover_thunk_) - { - tree attr = get_identifier("__no_split_stack__"); - DECL_ATTRIBUTES(decl) = tree_cons(attr, NULL_TREE, NULL_TREE); - } - - if (this->in_unique_section_) - resolve_unique_section (decl, 0, 1); - - go_preserve_from_gc(decl); - } - } - return this->fndecl_; -} - -// Get a tree for a function declaration. - -tree -Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) -{ - if (this->fndecl_ == NULL_TREE) + if (this->fndecl_ == NULL) { // Let Go code use an asm declaration to pick up a builtin // function. @@ -1412,58 +1229,46 @@ Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id) builtin_functions.find(this->asm_name_); if (p != builtin_functions.end()) { - this->fndecl_ = p->second; + this->fndecl_ = tree_to_function(p->second); return this->fndecl_; } } - tree functype = type_to_tree(this->fntype_->get_backend(gogo)); - - if (functype != error_mark_node) - { - // The type of a function comes back as a pointer to a - // struct whose first field is the function, but we want the - // real function type for a function declaration. - go_assert(POINTER_TYPE_P(functype) - && TREE_CODE(TREE_TYPE(functype)) == RECORD_TYPE); - functype = TREE_TYPE(TYPE_FIELDS(TREE_TYPE(functype))); - go_assert(FUNCTION_POINTER_TYPE_P(functype)); - functype = TREE_TYPE(functype); - } - - tree decl; - if (functype == error_mark_node) - decl = error_mark_node; - else - { - decl = build_decl(this->location().gcc_location(), FUNCTION_DECL, id, - functype); - TREE_PUBLIC(decl) = 1; - DECL_EXTERNAL(decl) = 1; + std::string asm_name; + if (this->asm_name_.empty()) + { + asm_name = (no->package() == NULL + ? gogo->pkgpath_symbol() + : no->package()->pkgpath_symbol()); + asm_name.append(1, '.'); + asm_name.append(Gogo::unpack_hidden_name(no->name())); + if (this->fntype_->is_method()) + { + asm_name.append(1, '.'); + Type* rtype = this->fntype_->receiver()->type(); + asm_name.append(rtype->mangled_name(gogo)); + } + } - if (this->asm_name_.empty()) - { - std::string asm_name = (no->package() == NULL - ? gogo->pkgpath_symbol() - : no->package()->pkgpath_symbol()); - asm_name.append(1, '.'); - asm_name.append(Gogo::unpack_hidden_name(no->name())); - if (this->fntype_->is_method()) - { - asm_name.append(1, '.'); - Type* rtype = this->fntype_->receiver()->type(); - asm_name.append(rtype->mangled_name(gogo)); - } - SET_DECL_ASSEMBLER_NAME(decl, - get_identifier_from_string(asm_name)); - } - } - this->fndecl_ = decl; - go_preserve_from_gc(decl); + Btype* functype = this->fntype_->get_backend_fntype(gogo); + this->fndecl_ = + gogo->backend()->function(functype, no->get_id(gogo), asm_name, + true, true, true, false, false, + this->location()); } + return this->fndecl_; } +// Return the function's decl after it has been built. + +tree +Function::get_decl() const +{ + go_assert(this->fndecl_ != NULL); + return function_to_tree(this->fndecl_); +} + // We always pass the receiver to a method as a pointer. If the // receiver is actually declared as a non-pointer type, then we copy // the value into a local variable, so that it has the right type. In @@ -1558,7 +1363,7 @@ Function::copy_parm_to_heap(Gogo* gogo, Named_object* no, tree var_decl) void Function::build_tree(Gogo* gogo, Named_object* named_function) { - tree fndecl = this->fndecl_; + tree fndecl = this->get_decl(); go_assert(fndecl != NULL_TREE); tree params = NULL_TREE; @@ -1796,7 +1601,7 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function, set = NULL_TREE; else set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, - DECL_RESULT(this->fndecl_), retval); + DECL_RESULT(this->get_decl()), retval); tree ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, void_type_node, set); append_to_statement_list(ret_stmt, &stmt_list); @@ -1851,7 +1656,7 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function, retval = this->return_value(gogo, named_function, end_loc, &stmt_list); set = fold_build2_loc(end_loc.gcc_location(), MODIFY_EXPR, void_type_node, - DECL_RESULT(this->fndecl_), retval); + DECL_RESULT(this->get_decl()), retval); ret_stmt = fold_build1_loc(end_loc.gcc_location(), RETURN_EXPR, void_type_node, set); @@ -1869,7 +1674,7 @@ Function::build_defer_wrapper(Gogo* gogo, Named_object* named_function, *fini = stmt_list; } -// Return the value to assign to DECL_RESULT(this->fndecl_). This may +// Return the value to assign to DECL_RESULT(this->get_decl()). This may // also add statements to STMT_LIST, which need to be executed before // the assignment. This is used for a return statement with no // explicit values. @@ -1902,7 +1707,7 @@ Function::return_value(Gogo* gogo, Named_object* named_function, } else { - tree rettype = TREE_TYPE(DECL_RESULT(this->fndecl_)); + tree rettype = TREE_TYPE(DECL_RESULT(this->get_decl())); retval = create_tmp_var(rettype, "RESULT"); tree field = TYPE_FIELDS(rettype); int index = 0; @@ -2323,18 +2128,14 @@ Gogo::interface_method_table_for_type(const Interface_type* interface, go_assert(m != NULL); Named_object* no = m->named_object(); - - tree fnid = no->get_id(this); - - tree fndecl; + Bfunction* bf; if (no->is_function()) - fndecl = no->func_value()->get_or_make_decl(this, no, fnid); + bf = no->func_value()->get_or_make_decl(this, no); else if (no->is_function_declaration()) - fndecl = no->func_declaration_value()->get_or_make_decl(this, no, - fnid); + bf = no->func_declaration_value()->get_or_make_decl(this, no); else go_unreachable(); - fndecl = build_fold_addr_expr(fndecl); + tree fndecl = build_fold_addr_expr(function_to_tree(bf)); elt = pointers->quick_push(empty); elt->index = size_int(i); @@ -2353,10 +2154,11 @@ Gogo::interface_method_table_for_type(const Interface_type* interface, TREE_CONSTANT(decl) = 1; DECL_INITIAL(decl) = constructor; - // If the interface type has hidden methods, then this is the only - // definition of the table. Otherwise it is a comdat table which - // may be defined in multiple packages. - if (has_hidden_methods) + // If the interface type has hidden methods, and the table is for a + // named type, then this is the only definition of the table. + // Otherwise it is a comdat table which may be defined in multiple + // packages. + if (has_hidden_methods && type->named_type() != NULL) TREE_PUBLIC(decl) = 1; else { diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 9f918cb81c7..eebb75377fa 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3320,7 +3320,8 @@ Function::Function(Function_type* type, Function* enclosing, Block* block, closure_var_(NULL), block_(block), location_(location), labels_(), local_type_count_(0), descriptor_(NULL), fndecl_(NULL), defer_stack_(NULL), is_sink_(false), results_are_named_(false), nointerface_(false), - calls_recover_(false), is_recover_thunk_(false), has_recover_thunk_(false), + is_unnamed_type_stub_method_(false), calls_recover_(false), + is_recover_thunk_(false), has_recover_thunk_(false), in_unique_section_(false) { } @@ -3819,6 +3820,81 @@ Function::import_func(Import* imp, std::string* pname, *presults = results; } +// Get the backend representation. + +Bfunction* +Function::get_or_make_decl(Gogo* gogo, Named_object* no) +{ + if (this->fndecl_ == NULL) + { + std::string asm_name; + bool is_visible = false; + if (no->package() != NULL) + ; + else if (this->enclosing_ != NULL || Gogo::is_thunk(no)) + ; + else if (Gogo::unpack_hidden_name(no->name()) == "init" + && !this->type_->is_method()) + ; + else if (Gogo::unpack_hidden_name(no->name()) == "main" + && gogo->is_main_package()) + is_visible = true; + // Methods have to be public even if they are hidden because + // they can be pulled into type descriptors when using + // anonymous fields. + else if (!Gogo::is_hidden_name(no->name()) + || this->type_->is_method()) + { + if (!this->is_unnamed_type_stub_method_) + is_visible = true; + std::string pkgpath = gogo->pkgpath_symbol(); + if (this->type_->is_method() + && Gogo::is_hidden_name(no->name()) + && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath()) + { + // This is a method we created for an unexported + // method of an imported embedded type. We need to + // use the pkgpath of the imported package to avoid + // a possible name collision. See bug478 for a test + // case. + pkgpath = Gogo::hidden_name_pkgpath(no->name()); + pkgpath = Gogo::pkgpath_for_symbol(pkgpath); + } + + asm_name = pkgpath; + asm_name.append(1, '.'); + asm_name.append(Gogo::unpack_hidden_name(no->name())); + if (this->type_->is_method()) + { + asm_name.append(1, '.'); + Type* rtype = this->type_->receiver()->type(); + asm_name.append(rtype->mangled_name(gogo)); + } + } + + // If a function calls the predeclared recover function, we + // can't inline it, because recover behaves differently in a + // function passed directly to defer. If this is a recover + // thunk that we built to test whether a function can be + // recovered, we can't inline it, because that will mess up + // our return address comparison. + bool is_inlinable = !(this->calls_recover_ || this->is_recover_thunk_); + + // If this is a thunk created to call a function which calls + // the predeclared recover function, we need to disable + // stack splitting for the thunk. + bool disable_split_stack = this->is_recover_thunk_; + + Btype* functype = this->type_->get_backend_fntype(gogo); + this->fndecl_ = + gogo->backend()->function(functype, no->get_id(gogo), asm_name, + is_visible, false, is_inlinable, + disable_split_stack, + this->in_unique_section_, this->location()); + } + return this->fndecl_; +} + // Class Block. Block::Block(Block* enclosing, Location location) @@ -5110,6 +5186,75 @@ Named_object::get_backend_variable(Gogo* gogo, Named_object* function) go_unreachable(); } + +// Return the external identifier for this object. + +std::string +Named_object::get_id(Gogo* gogo) +{ + go_assert(!this->is_variable() && !this->is_result_variable()); + std::string decl_name; + if (this->is_function_declaration() + && !this->func_declaration_value()->asm_name().empty()) + decl_name = this->func_declaration_value()->asm_name(); + else if (this->is_type() + && Linemap::is_predeclared_location(this->type_value()->location())) + { + // We don't need the package name for builtin types. + decl_name = Gogo::unpack_hidden_name(this->name_); + } + else + { + std::string package_name; + if (this->package_ == NULL) + package_name = gogo->package_name(); + else + package_name = this->package_->package_name(); + + // Note that this will be misleading if this is an unexported + // method generated for an embedded imported type. In that case + // the unexported method should have the package name of the + // package from which it is imported, but we are going to give + // it our package name. Fixing this would require knowing the + // package name, but we only know the package path. It might be + // better to use package paths here anyhow. This doesn't affect + // the assembler code, because we always set that name in + // Function::get_or_make_decl anyhow. FIXME. + + decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_); + + Function_type* fntype; + if (this->is_function()) + fntype = this->func_value()->type(); + else if (this->is_function_declaration()) + fntype = this->func_declaration_value()->type(); + else + fntype = NULL; + if (fntype != NULL && fntype->is_method()) + { + decl_name.push_back('.'); + decl_name.append(fntype->receiver()->type()->mangled_name(gogo)); + } + } + if (this->is_type()) + { + unsigned int index; + const Named_object* in_function = this->type_value()->in_function(&index); + if (in_function != NULL) + { + decl_name += '$' + Gogo::unpack_hidden_name(in_function->name()); + if (index > 0) + { + char buf[30]; + snprintf(buf, sizeof buf, "%u", index); + decl_name += '$'; + decl_name += buf; + } + } + } + return decl_name; +} + // Class Bindings. Bindings::Bindings(Bindings* enclosing) diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index 23968d4a191..31b258d62d6 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -48,6 +48,7 @@ class Bstatement; class Bblock; class Bvariable; class Blabel; +class Bfunction; // This file declares the basic classes used to hold the internal // representation of Go which is built by the parser. @@ -952,6 +953,15 @@ class Function this->nointerface_ = true; } + // Record that this function is a stub method created for an unnamed + // type. + void + set_is_unnamed_type_stub_method() + { + go_assert(this->is_method()); + this->is_unnamed_type_stub_method_ = true; + } + // Add a new field to the closure variable. void add_closure_field(Named_object* var, Location loc) @@ -1089,17 +1099,13 @@ class Function this->descriptor_ = descriptor; } - // Return the function's decl given an identifier. - tree - get_or_make_decl(Gogo*, Named_object*, tree id); + // Return the backend representation. + Bfunction* + get_or_make_decl(Gogo*, Named_object*); // Return the function's decl after it has been built. tree - get_decl() const - { - go_assert(this->fndecl_ != NULL); - return this->fndecl_; - } + get_decl() const; // Set the function decl to hold a tree of the function code. void @@ -1170,7 +1176,7 @@ class Function // The function descriptor, if any. Expression* descriptor_; // The function decl. - tree fndecl_; + Bfunction* fndecl_; // The defer stack variable. A pointer to this variable is used to // distinguish the defer stack for one function from another. This // is NULL unless we actually need a defer stack. @@ -1181,6 +1187,9 @@ class Function bool results_are_named_ : 1; // True if this method should not be included in the type descriptor. bool nointerface_ : 1; + // True if this function is a stub method created for an unnamed + // type. + bool is_unnamed_type_stub_method_ : 1; // True if this function calls the predeclared recover function. bool calls_recover_ : 1; // True if this a thunk built for a function which calls recover. @@ -1265,9 +1274,9 @@ class Function_declaration has_descriptor() const { return this->descriptor_ != NULL; } - // Return a decl for the function given an identifier. - tree - get_or_make_decl(Gogo*, Named_object*, tree id); + // Return a backend representation. + Bfunction* + get_or_make_decl(Gogo*, Named_object*); // If there is a descriptor, build it into the backend // representation. @@ -1290,7 +1299,7 @@ class Function_declaration // The function descriptor, if any. Expression* descriptor_; // The function decl if needed. - tree fndecl_; + Bfunction* fndecl_; }; // A variable. @@ -2181,8 +2190,8 @@ class Named_object Bvariable* get_backend_variable(Gogo*, Named_object* function); - // Return a tree for the external identifier for this object. - tree + // Return the external identifier for this object. + std::string get_id(Gogo*); // Return a tree representing this object. diff --git a/gcc/go/gofrontend/import.h b/gcc/go/gofrontend/import.h index c6844cda8a5..9917937e4d3 100644 --- a/gcc/go/gofrontend/import.h +++ b/gcc/go/gofrontend/import.h @@ -149,6 +149,11 @@ class Import location() const { return this->location_; } + // Return the package we are importing. + Package* + package() const + { return this->package_; } + // Return the next character. int peek_char() diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 22a1f6e2a0c..16169634733 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -873,7 +873,28 @@ Lex::gather_identifier() && (cc < 'a' || cc > 'z') && cc != '_' && (cc < '0' || cc > '9')) - break; + { + // Check for an invalid character here, as we get better + // error behaviour if we swallow them as part of the + // identifier we are building. + if ((cc >= ' ' && cc < 0x7f) + || cc == '\t' + || cc == '\r' + || cc == '\n') + break; + + this->lineoff_ = p - this->linebuf_; + error_at(this->location(), + "invalid character 0x%x in identifier", + cc); + if (!has_non_ascii_char) + { + buf.assign(pstart, p - pstart); + has_non_ascii_char = true; + } + if (!Lex::is_invalid_identifier(buf)) + buf.append("$INVALID$"); + } ++p; if (is_first) { diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 498125bb241..9c7d8277efa 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -744,6 +744,8 @@ Parse::signature(Typed_identifier* receiver, Location location) return NULL; Parse::Names names; + if (receiver != NULL) + names[receiver->name()] = receiver; if (params != NULL) this->check_signature_names(params, &names); if (results != NULL) diff --git a/gcc/go/gofrontend/runtime.cc b/gcc/go/gofrontend/runtime.cc index ecc508d0dcc..3b0f1880758 100644 --- a/gcc/go/gofrontend/runtime.cc +++ b/gcc/go/gofrontend/runtime.cc @@ -42,6 +42,8 @@ enum Runtime_function_type RFT_RUNE, // Go type float64, C type double. RFT_FLOAT64, + // Go type complex64, C type __complex float. + RFT_COMPLEX64, // Go type complex128, C type __complex double. RFT_COMPLEX128, // Go type string, C type struct __go_string. @@ -126,6 +128,10 @@ runtime_function_type(Runtime_function_type bft) t = Type::lookup_float_type("float64"); break; + case RFT_COMPLEX64: + t = Type::lookup_complex_type("complex64"); + break; + case RFT_COMPLEX128: t = Type::lookup_complex_type("complex128"); break; @@ -216,6 +222,7 @@ convert_to_runtime_function_type(Runtime_function_type bft, Expression* e, case RFT_UINTPTR: case RFT_RUNE: case RFT_FLOAT64: + case RFT_COMPLEX64: case RFT_COMPLEX128: case RFT_STRING: case RFT_POINTER: diff --git a/gcc/go/gofrontend/runtime.def b/gcc/go/gofrontend/runtime.def index 0d3fd3c43f1..a303a50410f 100644 --- a/gcc/go/gofrontend/runtime.def +++ b/gcc/go/gofrontend/runtime.def @@ -68,6 +68,12 @@ DEF_GO_RUNTIME(STRING_TO_INT_ARRAY, "__go_string_to_int_array", P1(STRING), R1(SLICE)) +// Complex division. +DEF_GO_RUNTIME(COMPLEX64_DIV, "__go_complex64_div", + P2(COMPLEX64, COMPLEX64), R1(COMPLEX64)) +DEF_GO_RUNTIME(COMPLEX128_DIV, "__go_complex128_div", + P2(COMPLEX128, COMPLEX128), R1(COMPLEX128)) + // Make a slice. DEF_GO_RUNTIME(MAKESLICE1, "__go_make_slice1", P2(TYPE, UINTPTR), R1(SLICE)) DEF_GO_RUNTIME(MAKESLICE2, "__go_make_slice2", P3(TYPE, UINTPTR, UINTPTR), diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index e1d68e74345..40b62f41bc0 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -3382,6 +3382,68 @@ Function_type::do_hash_for_method(Gogo* gogo) const // Get the backend representation for a function type. +Btype* +Function_type::get_backend_fntype(Gogo* gogo) +{ + if (this->fnbtype_ == NULL) + { + Backend::Btyped_identifier breceiver; + if (this->receiver_ != NULL) + { + breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); + + // We always pass the address of the receiver parameter, in + // order to make interface calls work with unknown types. + Type* rtype = this->receiver_->type(); + if (rtype->points_to() == NULL) + rtype = Type::make_pointer_type(rtype); + breceiver.btype = rtype->get_backend(gogo); + breceiver.location = this->receiver_->location(); + } + + std::vector bparameters; + if (this->parameters_ != NULL) + { + bparameters.resize(this->parameters_->size()); + size_t i = 0; + for (Typed_identifier_list::const_iterator p = + this->parameters_->begin(); p != this->parameters_->end(); + ++p, ++i) + { + bparameters[i].name = Gogo::unpack_hidden_name(p->name()); + bparameters[i].btype = p->type()->get_backend(gogo); + bparameters[i].location = p->location(); + } + go_assert(i == bparameters.size()); + } + + std::vector bresults; + if (this->results_ != NULL) + { + bresults.resize(this->results_->size()); + size_t i = 0; + for (Typed_identifier_list::const_iterator p = + this->results_->begin(); p != this->results_->end(); + ++p, ++i) + { + bresults[i].name = Gogo::unpack_hidden_name(p->name()); + bresults[i].btype = p->type()->get_backend(gogo); + bresults[i].location = p->location(); + } + go_assert(i == bresults.size()); + } + + this->fnbtype_ = gogo->backend()->function_type(breceiver, bparameters, + bresults, + this->location()); + + } + + return this->fnbtype_; +} + +// Get the backend representation for a Go function type. + Btype* Function_type::do_get_backend(Gogo* gogo) { @@ -3395,57 +3457,9 @@ Function_type::do_get_backend(Gogo* gogo) gogo->backend()->placeholder_struct_type("__go_descriptor", loc); Btype* ptr_struct_type = gogo->backend()->pointer_type(struct_type); - Backend::Btyped_identifier breceiver; - if (this->receiver_ != NULL) - { - breceiver.name = Gogo::unpack_hidden_name(this->receiver_->name()); - - // We always pass the address of the receiver parameter, in - // order to make interface calls work with unknown types. - Type* rtype = this->receiver_->type(); - if (rtype->points_to() == NULL) - rtype = Type::make_pointer_type(rtype); - breceiver.btype = rtype->get_backend(gogo); - breceiver.location = this->receiver_->location(); - } - - std::vector bparameters; - if (this->parameters_ != NULL) - { - bparameters.resize(this->parameters_->size()); - size_t i = 0; - for (Typed_identifier_list::const_iterator p = this->parameters_->begin(); - p != this->parameters_->end(); - ++p, ++i) - { - bparameters[i].name = Gogo::unpack_hidden_name(p->name()); - bparameters[i].btype = p->type()->get_backend(gogo); - bparameters[i].location = p->location(); - } - go_assert(i == bparameters.size()); - } - - std::vector bresults; - if (this->results_ != NULL) - { - bresults.resize(this->results_->size()); - size_t i = 0; - for (Typed_identifier_list::const_iterator p = this->results_->begin(); - p != this->results_->end(); - ++p, ++i) - { - bresults[i].name = Gogo::unpack_hidden_name(p->name()); - bresults[i].btype = p->type()->get_backend(gogo); - bresults[i].location = p->location(); - } - go_assert(i == bresults.size()); - } - - Btype* fntype = gogo->backend()->function_type(breceiver, bparameters, - bresults, loc); std::vector fields(1); fields[0].name = "code"; - fields[0].btype = fntype; + fields[0].btype = this->get_backend_fntype(gogo); fields[0].location = loc; if (!gogo->backend()->set_placeholder_struct_type(struct_type, fields)) return gogo->backend()->error_type(); @@ -4264,12 +4278,7 @@ Struct_type::do_verify() ++p) { Type* t = p->type(); - if (t->is_undefined()) - { - error_at(p->location(), "struct field type is incomplete"); - p->set_type(Type::make_error_type()); - } - else if (p->is_anonymous()) + if (p->is_anonymous()) { if (t->named_type() != NULL && t->points_to() != NULL) { @@ -5249,6 +5258,19 @@ Struct_type::do_import(Import* imp) } Type* ftype = imp->read_type(); + // We don't pack the names of builtin types. In + // Struct_field::is_field_name we cope with a hack. Now we + // need another hack so that we don't accidentally think + // that an embedded builtin type is accessible from another + // package (we know that all the builtin types are not + // exported). + if (name.empty() && ftype->deref()->named_type() != NULL) + { + const std::string fn(ftype->deref()->named_type()->name()); + if (fn[0] >= 'a' && fn[0] <= 'z') + name = '.' + imp->package()->pkgpath() + '.' + fn; + } + Struct_field sf(Typed_identifier(name, ftype, imp->location())); if (imp->peek_char() == ' ') @@ -9022,6 +9044,8 @@ Type::build_stub_methods(Gogo* gogo, const Type* type, const Methods* methods, fntype->is_varargs(), location); gogo->finish_function(fntype->location()); + if (type->named_type() == NULL && stub->is_function()) + stub->func_value()->set_is_unnamed_type_stub_method(); if (m->nointerface() && stub->is_function()) stub->func_value()->set_nointerface(); } diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index d8a3080f586..928c593a919 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -1717,7 +1717,8 @@ class Function_type : public Type Typed_identifier_list* results, Location location) : Type(TYPE_FUNCTION), receiver_(receiver), parameters_(parameters), results_(results), - location_(location), is_varargs_(false), is_builtin_(false) + location_(location), is_varargs_(false), is_builtin_(false), + fnbtype_(NULL) { } // Get the receiver. @@ -1798,6 +1799,11 @@ class Function_type : public Type static Type* make_function_type_descriptor_type(); + // Return the backend representation of this function type. This is used + // as the real type of a backend function declaration or defintion. + Btype* + get_backend_fntype(Gogo*); + protected: int do_traverse(Traverse*); @@ -1851,6 +1857,9 @@ class Function_type : public Type // Whether this is a special builtin function which can not simply // be called. This is used for len, cap, etc. bool is_builtin_; + // The backend representation of this type for backend function + // declarations and definitions. + Btype* fnbtype_; }; // The type of a pointer. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index c81c66cb07f..957f23ced9f 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -424,6 +424,7 @@ runtime_files = \ runtime/go-caller.c \ runtime/go-callers.c \ runtime/go-can-convert-interface.c \ + runtime/go-cdiv.c \ runtime/go-cgo.c \ runtime/go-check-interface.c \ runtime/go-construct-map.c \ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 9e31e8ca28e..706a72e1d82 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -195,7 +195,7 @@ libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \ @LIBGO_IS_LINUX_TRUE@am__objects_5 = getncpu-linux.lo am__objects_6 = go-append.lo go-assert.lo go-assert-interface.lo \ go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ - go-callers.lo go-can-convert-interface.lo go-cgo.lo \ + go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ go-check-interface.lo go-construct-map.lo \ go-convert-interface.lo go-copy.lo go-defer.lo \ go-deferred-recover.lo go-eface-compare.lo \ @@ -757,6 +757,7 @@ runtime_files = \ runtime/go-caller.c \ runtime/go-callers.c \ runtime/go-can-convert-interface.c \ + runtime/go-cdiv.c \ runtime/go-cgo.c \ runtime/go-check-interface.c \ runtime/go-construct-map.c \ @@ -2368,6 +2369,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@ @@ -2554,6 +2556,13 @@ go-can-convert-interface.lo: runtime/go-can-convert-interface.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-can-convert-interface.lo `test -f 'runtime/go-can-convert-interface.c' || echo '$(srcdir)/'`runtime/go-can-convert-interface.c +go-cdiv.lo: runtime/go-cdiv.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cdiv.lo -MD -MP -MF $(DEPDIR)/go-cdiv.Tpo -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c + go-cgo.lo: runtime/go-cgo.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cgo.lo -MD -MP -MF $(DEPDIR)/go-cgo.Tpo -c -o go-cgo.lo `test -f 'runtime/go-cgo.c' || echo '$(srcdir)/'`runtime/go-cgo.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo diff --git a/libgo/runtime/go-cdiv.c b/libgo/runtime/go-cdiv.c new file mode 100644 index 00000000000..0a81e458c84 --- /dev/null +++ b/libgo/runtime/go-cdiv.c @@ -0,0 +1,46 @@ +/* go-cdiv.c -- complex division routines + + Copyright 2013 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. */ + +/* Calls to these functions are generated by the Go frontend for + division of complex64 or complex128. We use these because Go's + complex division expects slightly different results from the GCC + default. When dividing NaN+1.0i / 0+0i, Go expects NaN+NaNi but + GCC generates NaN+Infi. NaN+Infi seems wrong seems the rules of + C99 Annex G specify that if either side of a complex number is Inf, + the the whole number is Inf, but an operation involving NaN ought + to result in NaN, not Inf. */ + +__complex float +__go_complex64_div (__complex float a, __complex float b) +{ + if (__builtin_expect (b == 0+0i, 0)) + { + if (!__builtin_isinff (__real__ a) + && !__builtin_isinff (__imag__ a) + && (__builtin_isnanf (__real__ a) || __builtin_isnanf (__imag__ a))) + { + /* Pass "1" to nanf to match math/bits.go. */ + return __builtin_nanf("1") + __builtin_nanf("1")*1i; + } + } + return a / b; +} + +__complex double +__go_complex128_div (__complex double a, __complex double b) +{ + if (__builtin_expect (b == 0+0i, 0)) + { + if (!__builtin_isinf (__real__ a) + && !__builtin_isinf (__imag__ a) + && (__builtin_isnan (__real__ a) || __builtin_isnan (__imag__ a))) + { + /* Pass "1" to nan to match math/bits.go. */ + return __builtin_nan("1") + __builtin_nan("1")*1i; + } + } + return a / b; +} diff --git a/libgo/runtime/go-make-slice.c b/libgo/runtime/go-make-slice.c index 591ab37e0c6..f08cb012dc8 100644 --- a/libgo/runtime/go-make-slice.c +++ b/libgo/runtime/go-make-slice.c @@ -34,7 +34,10 @@ __go_make_slice2 (const struct __go_type_descriptor *td, uintptr_t len, std = (const struct __go_slice_type *) td; ilen = (intgo) len; - if (ilen < 0 || (uintptr_t) ilen != len) + if (ilen < 0 + || (uintptr_t) ilen != len + || (std->__element_type->__size > 0 + && len > MaxMem / std->__element_type->__size)) runtime_panicstring ("makeslice: len out of range"); icap = (intgo) cap; diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 9771b71cfcf..23a94db4157 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -399,6 +399,9 @@ sig_tramp_info (int sig, Siginfo *info, void *context) { G *gp; M *mp; +#ifdef USING_SPLIT_STACK + void *stack_context[10]; +#endif /* We are now running on the stack registered via sigaltstack. (Actually there is a small span of time between runtime_siginit @@ -409,7 +412,7 @@ sig_tramp_info (int sig, Siginfo *info, void *context) if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_getcontext (&gp->stack_context[0]); + __splitstack_getcontext (&stack_context[0]); #endif } @@ -432,7 +435,7 @@ sig_tramp_info (int sig, Siginfo *info, void *context) if (gp != NULL) { #ifdef USING_SPLIT_STACK - __splitstack_setcontext (&gp->stack_context[0]); + __splitstack_setcontext (&stack_context[0]); #endif } } -- cgit v1.2.3 From ff3930674ae7d5c738b3f7727c22c758ac88cefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dumont?= Date: Wed, 16 Oct 2013 20:09:18 +0000 Subject: =?UTF-8?q?2013-10-16=20=20Fran=C3=A7ois=20Dumont=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR libstdc++/58191 * include/debug/macros.h (__glibcxx_check_partitioned_lower): Add __gnu_debug::__base calls on iterators passed to internal debug check. (__glibcxx_check_partitioned_lower_pred): Likewise. (__glibcxx_check_partitioned_upper): Likewise. (__glibcxx_check_partitioned_upper_pred): Likewise. * include/debug/functions.h (__check_partitioned_lower): Remove code to detect safe iterators. (__check_partitioned_upper): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203719 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 ++++ libstdc++-v3/include/debug/functions.h | 122 +++------------------------------ libstdc++-v3/include/debug/macros.h | 20 +++--- 3 files changed, 36 insertions(+), 119 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ee062c766c6..c024336cc0d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2013-10-16 François Dumont + + PR libstdc++/58191 + * include/debug/macros.h (__glibcxx_check_partitioned_lower): Add + __gnu_debug::__base calls on iterators passed to internal debug + check. + (__glibcxx_check_partitioned_lower_pred): Likewise. + (__glibcxx_check_partitioned_upper): Likewise. + (__glibcxx_check_partitioned_upper_pred): Likewise. + * include/debug/functions.h (__check_partitioned_lower): + Remove code to detect safe iterators. + (__check_partitioned_upper): Likewise. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/libstdc++-v3/include/debug/functions.h b/libstdc++-v3/include/debug/functions.h index 3f16098185c..d3a1223ccba 100644 --- a/libstdc++-v3/include/debug/functions.h +++ b/libstdc++-v3/include/debug/functions.h @@ -345,11 +345,13 @@ namespace __gnu_debug return __check_sorted_set_aux(__first, __last, __pred, _SameType()); } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 270. Binary search requirements overly strict + // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - std::forward_iterator_tag) + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) { while (__first != __last && *__first < __value) ++__first; @@ -362,37 +364,10 @@ namespace __gnu_debug return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_lower_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_lower_aux(__first.base(), __last.base(), - __value, __tag); - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 270. Binary search requirements overly strict - // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower(_ForwardIterator __first, + __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) - { - return __check_partitioned_lower_aux(__first, __last, __value, - std::__iterator_category(__first)); - } - - template - inline bool - __check_partitioned_upper_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - std::forward_iterator_tag) { while (__first != __last && !(__value < *__first)) ++__first; @@ -405,35 +380,12 @@ namespace __gnu_debug return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_upper_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_upper_aux(__first.base(), __last.base(), - __value, __tag); - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value) - { - return __check_partitioned_upper_aux(__first, __last, __value, - std::__iterator_category(__first)); - } - + // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred, - std::forward_iterator_tag) + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) { while (__first != __last && bool(__pred(*__first, __value))) ++__first; @@ -446,38 +398,11 @@ namespace __gnu_debug return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_lower_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, _Pred __pred, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_lower_aux(__first.base(), __last.base(), - __value, __pred, __tag); - } - - // Determine if a sequence is partitioned w.r.t. this element. template inline bool - __check_partitioned_lower(_ForwardIterator __first, + __check_partitioned_upper(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Pred __pred) - { - return __check_partitioned_lower_aux(__first, __last, __value, __pred, - std::__iterator_category(__first)); - } - - template - inline bool - __check_partitioned_upper_aux(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred, - std::forward_iterator_tag) { while (__first != __last && !bool(__pred(__value, *__first))) ++__first; @@ -490,31 +415,6 @@ namespace __gnu_debug return __first == __last; } - // For performance reason, as the iterator range has been validated, check on - // random access safe iterators is done using the base iterator. - template - inline bool - __check_partitioned_upper_aux( - const _Safe_iterator<_Iterator, _Sequence>& __first, - const _Safe_iterator<_Iterator, _Sequence>& __last, - const _Tp& __value, _Pred __pred, - std::random_access_iterator_tag __tag) - { - return __check_partitioned_upper_aux(__first.base(), __last.base(), - __value, __pred, __tag); - } - - template - inline bool - __check_partitioned_upper(_ForwardIterator __first, - _ForwardIterator __last, const _Tp& __value, - _Pred __pred) - { - return __check_partitioned_upper_aux(__first, __last, __value, __pred, - std::__iterator_category(__first)); - } - // Helper struct to detect random access safe iterators. template struct __is_safe_random_iterator diff --git a/libstdc++-v3/include/debug/macros.h b/libstdc++-v3/include/debug/macros.h index 26732c9e3e2..31bcaf3618c 100644 --- a/libstdc++-v3/include/debug/macros.h +++ b/libstdc++-v3/include/debug/macros.h @@ -261,8 +261,9 @@ _GLIBCXX_DEBUG_VERIFY( \ w.r.t. the value _Value. */ #define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ - _Value), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -270,8 +271,9 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ #define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ - _Value), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ _M_message(__gnu_debug::__msg_unpartitioned) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -281,8 +283,9 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ - _Value, _Pred), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ @@ -293,8 +296,9 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower(_First, _Last, \ w.r.t. the value _Value and predicate _Pred. */ #define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ __glibcxx_check_valid_range(_First,_Last); \ -_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper(_First, _Last, \ - _Value, _Pred), \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ _M_message(__gnu_debug::__msg_unpartitioned_pred) \ ._M_iterator(_First, #_First) \ ._M_iterator(_Last, #_Last) \ -- cgit v1.2.3 From 07d7ace59ead588723f3e989830715093a0c0586 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 16 Oct 2013 21:58:58 +0000 Subject: PR c++/57850 * decl2.c (dump_tu): Split out from... (cp_write_global_declarations): ...here. Call it in PCH mode. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203728 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl2.c | 28 ++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f6249680f35..e24cb094cc1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-16 Jason Merrill + + PR c++/57850 + * decl2.c (dump_tu): Split out from... + (cp_write_global_declarations): ...here. Call it in PCH mode. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 628be934bff..9252233fe82 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3960,6 +3960,22 @@ handle_tls_init (void) expand_or_defer_fn (finish_function (0)); } +/* The entire file is now complete. If requested, dump everything + to a file. */ + +static void +dump_tu (void) +{ + int flags; + FILE *stream = dump_begin (TDI_tu, &flags); + + if (stream) + { + dump_node (global_namespace, flags & ~TDF_SLIM, stream); + dump_end (TDI_tu, stream); + } +} + /* This routine is called at the end of compilation. Its job is to create all the code needed to initialize and destroy the global aggregates. We do the destruction @@ -3990,6 +4006,7 @@ cp_write_global_declarations (void) if (pch_file) { c_common_write_pch (); + dump_tu (); return; } @@ -4359,16 +4376,7 @@ cp_write_global_declarations (void) /* The entire file is now complete. If requested, dump everything to a file. */ - { - int flags; - FILE *stream = dump_begin (TDI_tu, &flags); - - if (stream) - { - dump_node (global_namespace, flags & ~TDF_SLIM, stream); - dump_end (TDI_tu, stream); - } - } + dump_tu (); if (flag_detailed_statistics) { -- cgit v1.2.3 From f7f156a6f2b56e5bb906501be9a98c1110c112bd Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 16 Oct 2013 22:19:18 +0000 Subject: /cp 2013-10-16 Paolo Carlini PR c++/58633 * parser.c (cp_parser_pseudo_destructor_name): Revert r174385 changes. /testsuite 2013-10-16 Paolo Carlini PR c++/58633 * g++.dg/cpp0x/decltype57.C: New. * g++.dg/cpp0x/enum18.C: Revert r174385 changes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203730 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 4 ---- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/decltype57.C | 8 ++++++++ gcc/testsuite/g++.dg/cpp0x/enum18.C | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype57.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e24cb094cc1..11d4f32ef48 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-10-16 Paolo Carlini + + PR c++/58633 + * parser.c (cp_parser_pseudo_destructor_name): Revert r174385 changes. + 2013-10-16 Jason Merrill PR c++/57850 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b6322788fae..5b058d87cde 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6421,10 +6421,6 @@ cp_parser_pseudo_destructor_name (cp_parser* parser, /* Look for the `~'. */ cp_parser_require (parser, CPP_COMPL, RT_COMPL); - /* Once we see the ~, this has to be a pseudo-destructor. */ - if (!processing_template_decl && !cp_parser_error_occurred (parser)) - cp_parser_commit_to_tentative_parse (parser); - /* Look for the type-name again. We are not responsible for checking that it matches the first type-name. */ *type = cp_parser_nonclass_name (parser); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5a0b168ba64..85c2683e31b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-10-16 Paolo Carlini + + PR c++/58633 + * g++.dg/cpp0x/decltype57.C: New. + * g++.dg/cpp0x/enum18.C: Revert r174385 changes. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype57.C b/gcc/testsuite/g++.dg/cpp0x/decltype57.C new file mode 100644 index 00000000000..353cc72c335 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype57.C @@ -0,0 +1,8 @@ +// PR c++/58633 +// { dg-do compile { target c++11 } } + +void foo(int i) +{ + typedef int I; + decltype(i.I::~I())* p; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/enum18.C b/gcc/testsuite/g++.dg/cpp0x/enum18.C index 306ed8259f9..7361595c00e 100644 --- a/gcc/testsuite/g++.dg/cpp0x/enum18.C +++ b/gcc/testsuite/g++.dg/cpp0x/enum18.C @@ -4,5 +4,5 @@ int main(void) { enum e {}; e ev; - ev.e::~e_u(); // { dg-error "e_u. has not been declared" } + ev.e::~e_u(); // { dg-error "" } } -- cgit v1.2.3 From 773f432033f1f20955e059f946d6b0f537e96b02 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 17 Oct 2013 00:16:38 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203737 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8c8fa238b2c..72d946af181 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131016 +20131017 -- cgit v1.2.3 From ce2f0c91948f5a792b71a54d288e300b574986ae Mon Sep 17 00:00:00 2001 From: Christian Bruel Date: Thu, 17 Oct 2013 13:49:40 +0000 Subject: fix typo comment git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203759 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/sh/sh.opt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt index c314e144c21..8a6788eb3d1 100644 --- a/gcc/config/sh/sh.opt +++ b/gcc/config/sh/sh.opt @@ -21,7 +21,7 @@ ;; Used for various architecture options. Mask(SH_E) -;; Set if the default precision of th FPU is single. +;; Set if the default precision of the FPU is single. Mask(FPU_SINGLE) ;; Set if the a double-precision FPU is present but is restricted to -- cgit v1.2.3 From 3c69ae15e45caacbcc16ef49c01ea2000b757bf7 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 17 Oct 2013 15:43:50 +0000 Subject: compiler: Don't warn for unknown type when importing anonymous field. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203771 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/types.cc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 40b62f41bc0..c13bfea438d 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -5264,11 +5264,25 @@ Struct_type::do_import(Import* imp) // that an embedded builtin type is accessible from another // package (we know that all the builtin types are not // exported). - if (name.empty() && ftype->deref()->named_type() != NULL) + // This is called during parsing, before anything is + // lowered, so we have to be careful to avoid dereferencing + // an unknown type name. + if (name.empty()) { - const std::string fn(ftype->deref()->named_type()->name()); - if (fn[0] >= 'a' && fn[0] <= 'z') - name = '.' + imp->package()->pkgpath() + '.' + fn; + Type *t = ftype; + if (t->classification() == Type::TYPE_POINTER) + { + // Very ugly. + Pointer_type* ptype = static_cast(t); + t = ptype->points_to(); + } + std::string tname; + if (t->forward_declaration_type() != NULL) + tname = t->forward_declaration_type()->name(); + else if (t->named_type() != NULL) + tname = t->named_type()->name(); + if (!tname.empty() && tname[0] >= 'a' && tname[0] <= 'z') + name = '.' + imp->package()->pkgpath() + '.' + tname; } Struct_field sf(Typed_identifier(name, ftype, imp->location())); -- cgit v1.2.3 From d9a0f0c83d94a626fa888acbb1f9cdb01dfdda09 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Thu, 17 Oct 2013 17:15:46 +0000 Subject: /cp 2013-10-17 Paolo Carlini PR c++/58596 * semantics.c (lambda_expr_this_capture): Handle NSDMIs in the cp_unevaluated_operand case. /testsuite 2013-10-17 Paolo Carlini PR c++/58596 * g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203784 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 9 ++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 11d4f32ef48..d411523bbc7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-17 Paolo Carlini + + PR c++/58596 + * semantics.c (lambda_expr_this_capture): Handle NSDMIs in the + cp_unevaluated_operand case. + 2013-10-16 Paolo Carlini PR c++/58633 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 580c609ac9c..571fc7c6745 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -9481,7 +9481,14 @@ lambda_expr_this_capture (tree lambda) /* In unevaluated context this isn't an odr-use, so just return the nearest 'this'. */ if (cp_unevaluated_operand) - return lookup_name (this_identifier); + { + /* In an NSDMI the fake 'this' pointer that we're using for + parsing is in scope_chain. */ + if (LAMBDA_EXPR_EXTRA_SCOPE (lambda) + && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL) + return scope_chain->x_current_class_ptr; + return lookup_name (this_identifier); + } /* Try to default capture 'this' if we can. */ if (!this_capture diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85c2683e31b..3740c532739 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-17 Paolo Carlini + + PR c++/58596 + * g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New + 2013-10-16 Paolo Carlini PR c++/58633 diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C new file mode 100644 index 00000000000..1d2778fb5ac --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nsdmi5.C @@ -0,0 +1,7 @@ +// PR c++/58596 +// { dg-do compile { target c++11 } } + +struct A +{ + int i = [] { return decltype(i)(); }(); +}; -- cgit v1.2.3 From a6f74dc5540e3f616ccc0d45ffb92fc3f05cc869 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 17 Oct 2013 18:41:40 +0000 Subject: syscall: Add Dup3, {Get,List,Remove,Set}xattr, {Get,Set}priority. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203789 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/config.h.in | 15 +++++++++++ libgo/configure | 2 +- libgo/configure.ac | 2 +- libgo/go/syscall/libcall_linux.go | 15 +++++++++++ libgo/go/syscall/libcall_posix.go | 6 +++++ libgo/mksysinfo.sh | 4 +++ libgo/runtime/go-nosys.c | 57 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 99 insertions(+), 2 deletions(-) diff --git a/libgo/config.h.in b/libgo/config.h.in index 1057d9e85e4..f6da8b982c4 100644 --- a/libgo/config.h.in +++ b/libgo/config.h.in @@ -39,6 +39,9 @@ /* Define to 1 if you have the `dl_iterate_phdr' function. */ #undef HAVE_DL_ITERATE_PHDR +/* Define to 1 if you have the `dup3' function. */ +#undef HAVE_DUP3 + /* Define to 1 if you have the `epoll_create1' function. */ #undef HAVE_EPOLL_CREATE1 @@ -66,6 +69,9 @@ /* Define if _Unwind_GetIPInfo is available. */ #undef HAVE_GETIPINFO +/* Define to 1 if you have the `getxattr' function. */ +#undef HAVE_GETXATTR + /* Define to 1 if you have the `inotify_add_watch' function. */ #undef HAVE_INOTIFY_ADD_WATCH @@ -111,6 +117,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_RTNETLINK_H +/* Define to 1 if you have the `listxattr' function. */ +#undef HAVE_LISTXATTR + /* Define to 1 if the system has the type `loff_t'. */ #undef HAVE_LOFF_T @@ -171,6 +180,9 @@ /* Define to 1 if you have the `pipe2' function. */ #undef HAVE_PIPE2 +/* Define to 1 if you have the `removexattr' function. */ +#undef HAVE_REMOVEXATTR + /* Define to 1 if you have the `renameat' function. */ #undef HAVE_RENAMEAT @@ -180,6 +192,9 @@ /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV +/* Define to 1 if you have the `setxattr' function. */ +#undef HAVE_SETXATTR + /* Define to 1 if you have the `sinl' function. */ #undef HAVE_SINL diff --git a/libgo/configure b/libgo/configure index e54a2cd1b0c..c416dacc516 100755 --- a/libgo/configure +++ b/libgo/configure @@ -14700,7 +14700,7 @@ else fi -for ac_func in accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat +for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/libgo/configure.ac b/libgo/configure.ac index 81c0a88b0cd..8ce846d9fbf 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -503,7 +503,7 @@ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv dl_iterate_phdr) AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) -AC_CHECK_FUNCS(accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat) +AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat) AC_TYPE_OFF_T AC_CHECK_TYPES([loff_t]) diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go index 79de2f389e9..60eecd9ef89 100644 --- a/libgo/go/syscall/libcall_linux.go +++ b/libgo/go/syscall/libcall_linux.go @@ -190,6 +190,9 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { //sys Adjtimex(buf *Timex) (state int, err error) //adjtimex(buf *Timex) _C_int +//sysnb Dup3(oldfd int, newfd int, flags int) (err error) +//dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int + //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int @@ -268,6 +271,9 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, return origlen - len(buf), count, names } +//sys Getxattr(path string, attr string, dest []byte) (sz int, err error) +//getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t + //sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) //inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int @@ -283,6 +289,9 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, //sys Klogctl(typ int, buf []byte) (n int, err error) //klogctl(typ _C_int, bufp *byte, len _C_int) _C_int +//sys Listxattr(path string, dest []byte) (sz int, err error) +//listxattr(path *byte, list *byte, size Size_t) Ssize_t + //sys Mkdirat(dirfd int, path string, mode uint32) (err error) //mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int @@ -305,6 +314,9 @@ func Pipe2(p []int, flags int) (err error) { //sys PivotRoot(newroot string, putold string) (err error) //pivot_root(newroot *byte, putold *byte) _C_int +//sys Removexattr(path string, attr string) (err error) +//removexattr(path *byte, name *byte) _C_int + //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) //renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int @@ -338,6 +350,9 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sysnb Setresuid(ruid int, eguid int, suid int) (err error) //setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int +//sys Setxattr(path string, attr string, data []byte, flags int) (err error) +//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int + //sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error) //splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) { diff --git a/libgo/go/syscall/libcall_posix.go b/libgo/go/syscall/libcall_posix.go index 1e7823b541c..91ff59b6cfa 100644 --- a/libgo/go/syscall/libcall_posix.go +++ b/libgo/go/syscall/libcall_posix.go @@ -238,6 +238,9 @@ func FDZero(set *FdSet) { //sysnb Getppid() (ppid int) //getppid() Pid_t +//sys Getpriority(which int, who int) (prio int, err error) +//getpriority(which _C_int, who _C_int) _C_int + //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //getrlimit(resource _C_int, rlim *Rlimit) _C_int @@ -307,6 +310,9 @@ func Gettimeofday(tv *Timeval) (err error) { //sysnb Setpgid(pid int, pgid int) (err error) //setpgid(pid Pid_t, pgid Pid_t) _C_int +//sys Setpriority(which int, who int, prio int) (err error) +//setpriority(which _C_int, who _C_int, prio _C_int) _C_int + //sysnb Setreuid(ruid int, euid int) (err error) //setreuid(ruid Uid_t, euid Uid_t) _C_int diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh index 11bcb257a94..71c328627a6 100755 --- a/libgo/mksysinfo.sh +++ b/libgo/mksysinfo.sh @@ -1035,6 +1035,10 @@ grep '^type _utimbuf ' gen-sysinfo.go | \ grep '^const _LOCK_' gen-sysinfo.go | sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} +# The PRIO constants. +grep '^const _PRIO_' gen-sysinfo.go | \ + sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} + # The GNU/Linux LINUX_REBOOT flags. grep '^const _LINUX_REBOOT_' gen-sysinfo.go | sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} diff --git a/libgo/runtime/go-nosys.c b/libgo/runtime/go-nosys.c index 3ab5ea235f2..f389dbe0cbe 100644 --- a/libgo/runtime/go-nosys.c +++ b/libgo/runtime/go-nosys.c @@ -43,6 +43,17 @@ accept4 (int sockfd __attribute__ ((unused)), } #endif +#ifndef HAVE_DUP3 +int +dup3 (int oldfd __attribute__ ((unused)), + int newfd __attribute__ ((unused)), + int flags __attribtue__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_EPOLL_CREATE1 int epoll_create1 (int flags __attribute__ ((unused))) @@ -112,6 +123,18 @@ futimesat (int dirfd __attribute__ ((unused)), } #endif +#ifndef HAVE_GETXATTR +ssize_t +getxattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + void *value __attribute__ ((unused)), + size_t size __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_INOTIFY_ADD_WATCH int inotify_add_watch (int fd __attribute__ ((unused)), @@ -151,6 +174,17 @@ inotify_rm_watch (int fd __attribute__ ((unused)), } #endif +#ifndef HAVE_LISTXATTR +ssize_t +listxattr (const char *path __attribute__ ((unused)), + char *list __attribute__ ((unused)), + size_t size __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_MKDIRAT int mkdirat (int dirfd __attribute__ ((unused)), @@ -196,6 +230,16 @@ pipe2 (int pipefd[2] __attribute__ ((unused)), } #endif +#ifndef HAVE_REMOVEXATTR +int +removexattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_RENAMEAT int renameat (int olddirfd __attribute__ ((unused)), @@ -208,6 +252,19 @@ renameat (int olddirfd __attribute__ ((unused)), } #endif +#ifndef HAVE_SETXATTR +int +setxattr (const char *path __attribute__ ((unused)), + const char *name __attribute__ ((unused)), + const void *value __attribute__ ((unused)), + size_t size __attribute__ ((unused)), + int flags __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_SPLICE int splice (int fd __attribute__ ((unused)), -- cgit v1.2.3 From 581787648bb2e5a3861379d3d4e1480fe31975c5 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 17 Oct 2013 19:41:44 +0000 Subject: [gcc] 2013-10-17 Michael Meissner Backport from mainline 2013-10-17 Michael Meissner PR target/58673 * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only restrict TImode addresses to single indirect registers if both -mquad-memory and -mvsx-timode are used. (rs6000_output_move_128bit): Use quad_load_store_p to determine if we should emit load/store quad. Remove using %y for quad memory addresses. * config/rs6000/rs6000.md (mov_ppc64, TI/PTImode): Add constraints to allow load/store quad on machines where TImode is not allowed in VSX registers. Use 'n' instead of 'F' constraint for TImode to load integer constants. [gcc/testsuite] 2013-10-17 Michael Meissner Back port from mainline 2013-10-17 Michael Meissner PR target/58673 * gcc.target/powerpc/pr58673-1.c: New file to test whether -mquad-word + -mno-vsx-timode causes errors. * gcc.target/powerpc/pr58673-2.c: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@203793 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.ibm | 18 +++ gcc/config/rs6000/rs6000.c | 29 ++-- gcc/config/rs6000/rs6000.md | 6 +- gcc/testsuite/ChangeLog.ibm | 10 ++ gcc/testsuite/gcc.target/powerpc/pr58673-1.c | 78 ++++++++++ gcc/testsuite/gcc.target/powerpc/pr58673-2.c | 217 +++++++++++++++++++++++++++ 6 files changed, 336 insertions(+), 22 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr58673-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr58673-2.c diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index 23cbc063cc2..a5f3b06f6fb 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -1,3 +1,21 @@ +2013-10-17 Michael Meissner + + Backport from mainline + 2013-10-17 Michael Meissner + + PR target/58673 + * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only + restrict TImode addresses to single indirect registers if both + -mquad-memory and -mvsx-timode are used. + (rs6000_output_move_128bit): Use quad_load_store_p to determine if + we should emit load/store quad. Remove using %y for quad memory + addresses. + + * config/rs6000/rs6000.md (mov_ppc64, TI/PTImode): Add + constraints to allow load/store quad on machines where TImode is + not allowed in VSX registers. Use 'n' instead of 'F' constraint + for TImode to load integer constants. + 2013-10-02 Michael Meissner Backport from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 44681fc8580..dab5c766a59 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7100,12 +7100,12 @@ rs6000_legitimate_address_p (enum machine_mode mode, rtx x, bool reg_ok_strict) if (reg_offset_p && legitimate_constant_pool_address_p (x, mode, reg_ok_strict)) return 1; - /* For TImode, if we have load/store quad, only allow register indirect - addresses. This will allow the values to go in either GPRs or VSX - registers without reloading. The vector types would tend to go into VSX - registers, so we allow REG+REG, while TImode seems somewhat split, in that - some uses are GPR based, and some VSX based. */ - if (mode == TImode && TARGET_QUAD_MEMORY) + /* For TImode, if we have load/store quad and TImode in VSX registers, only + allow register indirect addresses. This will allow the values to go in + either GPRs or VSX registers without reloading. The vector types would + tend to go into VSX registers, so we allow REG+REG, while TImode seems + somewhat split, in that some uses are GPR based, and some VSX based. */ + if (mode == TImode && TARGET_QUAD_MEMORY && TARGET_VSX_TIMODE) return 0; /* If not REG_OK_STRICT (before reload) let pass any stack offset. */ if (! reg_ok_strict @@ -15998,13 +15998,8 @@ rs6000_output_move_128bit (rtx operands[]) { if (dest_gpr_p) { - if (TARGET_QUAD_MEMORY && (dest_regno & 1) == 0 - && quad_memory_operand (src, mode) - && !reg_overlap_mentioned_p (dest, src)) - { - /* lq/stq only has DQ-form, so avoid X-form that %y produces. */ - return REG_P (XEXP (src, 0)) ? "lq %0,%1" : "lq %0,%y1"; - } + if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src)) + return "lq %0,%1"; else return "#"; } @@ -16033,12 +16028,8 @@ rs6000_output_move_128bit (rtx operands[]) { if (src_gpr_p) { - if (TARGET_QUAD_MEMORY && (src_regno & 1) == 0 - && quad_memory_operand (dest, mode)) - { - /* lq/stq only has DQ-form, so avoid X-form that %y produces. */ - return REG_P (XEXP (dest, 0)) ? "stq %1,%0" : "stq %1,%y0"; - } + if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src)) + return "stq %1,%0"; else return "#"; } diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 47852c432a0..20b4ef32bfc 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -9976,15 +9976,15 @@ (const_string "conditional")))]) (define_insn "*mov_ppc64" - [(set (match_operand:TI2 0 "nonimmediate_operand" "=Y,r,r,r") - (match_operand:TI2 1 "input_operand" "r,Y,r,F"))] + [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r") + (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))] "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (mode) && (gpc_reg_operand (operands[0], mode) || gpc_reg_operand (operands[1], mode)))" { return rs6000_output_move_128bit (operands); } - [(set_attr "type" "store,load,*,*") + [(set_attr "type" "store,store,load,load,*,*") (set_attr "length" "8")]) (define_split diff --git a/gcc/testsuite/ChangeLog.ibm b/gcc/testsuite/ChangeLog.ibm index 760f288f945..7379416560f 100644 --- a/gcc/testsuite/ChangeLog.ibm +++ b/gcc/testsuite/ChangeLog.ibm @@ -1,3 +1,13 @@ +2013-10-17 Michael Meissner + + Back port from mainline + 2013-10-17 Michael Meissner + + PR target/58673 + * gcc.target/powerpc/pr58673-1.c: New file to test whether + -mquad-word + -mno-vsx-timode causes errors. + * gcc.target/powerpc/pr58673-2.c: Likewise. + 2013-08-19 Peter Bergner Back port from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/pr58673-1.c b/gcc/testsuite/gcc.target/powerpc/pr58673-1.c new file mode 100644 index 00000000000..6f7838f8dde --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr58673-1.c @@ -0,0 +1,78 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mcpu=power8 -m64 -O1" } */ + +enum typecode +{ + QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode, + DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE +}; +enum bytecode_opcode +{ + neverneverland, drop, duplicate, over, setstackSI, adjstackSI, constQI, + constHI, constSI, constDI, constSF, constDF, constXF, constP, loadQI, + loadHI, loadSI, loadDI, loadSF, loadDF, loadXF, loadP, storeQI, storeHI, + storeSI, storeDI, storeSF, storeDF, storeXF, storeP, storeBLK, clearBLK, + addconstPSI, newlocalSI, localP, argP, convertQIHI, convertHISI, + convertSIDI, convertQISI, convertQUHU, convertHUSU, convertSUDU, + convertQUSU, convertSFDF, convertDFXF, convertHIQI, convertSIHI, + convertDISI, convertSIQI, convertSUQU, convertDFSF, convertXFDF, + convertSISF, convertSIDF, convertSIXF, convertSUSF, convertSUDF, + convertSUXF, convertDISF, convertDIDF, convertDIXF, convertDUSF, + convertDUDF, convertDUXF, convertSFSI, convertDFSI, convertXFSI, + convertSFSU, convertDFSU, convertXFSU, convertSFDI, convertDFDI, + convertXFDI, convertSFDU, convertDFDU, convertXFDU, convertPSI, + convertSIP, convertSIT, convertDIT, convertSFT, convertDFT, convertXFT, + convertPT, zxloadBI, sxloadBI, sstoreBI, addSI, addDI, addSF, addDF, + addXF, addPSI, subSI, subDI, subSF, subDF, subXF, subPP, mulSI, mulDI, + mulSU, mulDU, mulSF, mulDF, mulXF, divSI, divDI, divSU, divDU, divSF, + divDF, divXF, modSI, modDI, modSU, modDU, andSI, andDI, iorSI, iorDI, + xorSI, xorDI, lshiftSI, lshiftSU, lshiftDI, lshiftDU, rshiftSI, rshiftSU, + rshiftDI, rshiftDU, ltSI, ltSU, ltDI, ltDU, ltSF, ltDF, ltXF, ltP, leSI, + leSU, leDI, leDU, leSF, leDF, leXF, leP, geSI, geSU, geDI, geDU, geSF, + geDF, geXF, geP, gtSI, gtSU, gtDI, gtDU, gtSF, gtDF, gtXF, gtP, eqSI, + eqDI, eqSF, eqDF, eqXF, eqP, neSI, neDI, neSF, neDF, neXF, neP, negSI, + negDI, negSF, negDF, negXF, notSI, notDI, notT, predecQI, predecHI, + predecSI, predecDI, predecP, predecSF, predecDF, predecXF, predecBI, + preincQI, preincHI, preincSI, preincDI, preincP, preincSF, preincDF, + preincXF, preincBI, postdecQI, postdecHI, postdecSI, postdecDI, postdecP, + postdecSF, postdecDF, postdecXF, postdecBI, postincQI, postincHI, + postincSI, postincDI, postincP, postincSF, postincDF, postincXF, + postincBI, xjumpif, xjumpifnot, jump, jumpP, caseSI, caseSU, caseDI, + caseDU, call, returnP, ret, linenote, LAST_AND_UNUSED_OPCODE +}; +struct binary_operator +{ + enum bytecode_opcode opcode; + enum typecode arg0; +}; +static struct conversion_recipe +{ + unsigned char *opcodes; + int cost; +} +conversion_recipe[((int) LAST_AND_UNUSED_TYPECODE)][((int) + LAST_AND_UNUSED_TYPECODE)]; +static struct conversion_recipe +deduce_conversion (from, to) + enum typecode from, to; +{ + (conversion_recipe[(int) from][(int) to]. + opcodes ? 0 : (conversion_recipe[(int) from][(int) to] = + deduce_conversion (from, to), 0)); +} + +void +bc_expand_binary_operation (optab, resulttype, arg0, arg1) + struct binary_operator optab[]; +{ + int i, besti, cost, bestcost; + enum typecode resultcode, arg0code; + for (i = 0; optab[i].opcode != -1; ++i) + { + (conversion_recipe[(int) arg0code][(int) optab[i].arg0]. + opcodes ? 0 : (conversion_recipe[(int) arg0code][(int) optab[i].arg0] = + deduce_conversion (arg0code, optab[i].arg0), 0)); + } +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr58673-2.c b/gcc/testsuite/gcc.target/powerpc/pr58673-2.c new file mode 100644 index 00000000000..b70d2eed88c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr58673-2.c @@ -0,0 +1,217 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mcpu=power8 -O3 -m64 -funroll-loops" } */ + +#include +#include +#include +#include + +typedef long unsigned int size_t; +typedef struct _IO_FILE FILE; +typedef float real; +typedef real rvec[3]; +typedef real matrix[3][3]; +typedef real tensor[3][3]; +enum +{ + F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC, + F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ, + F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES, + F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE, + F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD, + F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES, + F_DVDL, F_DVDLKIN, F_NRE +}; +typedef union +{ + struct + { + } + bham; + struct + { + real rA, krA, rB, krB; + } + harmonic; +} +t_iparams; +typedef struct +{ + t_iparams *iparams; +} +t_idef; +typedef struct +{ +} +t_inputrec; +typedef struct +{ +} +t_commrec; +typedef struct +{ +} +t_forcerec; +typedef struct +{ +} +t_mdatoms; +typedef struct +{ +} +t_filenm; +enum +{ + eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy, + eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory = + eoObsNR, eoInter, eoUseVirial, eoNR +}; +extern char *eoNames[eoNR]; +typedef struct +{ + int bPrint; +} +t_coupl_LJ; +typedef struct +{ + int eObs; + t_iparams xi; +} +t_coupl_iparams; +typedef struct +{ + real act_value[eoObsNR]; + real av_value[eoObsNR]; + real ref_value[eoObsNR]; + int bObsUsed[eoObsNR]; + int nLJ, nBU, nQ, nIP; + t_coupl_LJ *tcLJ; +} +t_coupl_rec; +static void +pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile, + t_filenm fnm[]) +{ + static FILE *prop; + static FILE **out = ((void *) 0); + static FILE **qq = ((void *) 0); + static FILE **ip = ((void *) 0); + char buf[256]; + char *leg[] = { + "C12", "C6" + }; + char **raleg; + int i, j, index; + if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0)) + && (ip == ((void *) 0))) + { + for (i = j = 0; (i < eoObsNR); i++) + { + if (tcr->bObsUsed[i]) + { + raleg[j++] = + (__extension__ + (__builtin_constant_p (eoNames[i]) + && ((size_t) (const void *) ((eoNames[i]) + 1) - + (size_t) (const void *) (eoNames[i]) == + 1) ? (((const char *) (eoNames[i]))[0] == + '\0' ? (char *) calloc ((size_t) 1, + (size_t) 1) : ( + { + size_t + __len + = + strlen + (eoNames + [i]) + + + 1; + char + *__retval + = + (char + *) + malloc + (__len); + __retval;} + )): __strdup (eoNames[i]))); + raleg[j++] = + (__extension__ + (__builtin_constant_p (buf) + && ((size_t) (const void *) ((buf) + 1) - + (size_t) (const void *) (buf) == + 1) ? (((const char *) (buf))[0] == + '\0' ? (char *) calloc ((size_t) 1, + (size_t) 1) : ( + { + size_t + __len + = + strlen + (buf) + + + 1; + char + *__retval + = + (char + *) + malloc + (__len); + __retval;} + )): __strdup (buf))); + } + } + if (tcr->nLJ) + { + for (i = 0; (i < tcr->nLJ); i++) + { + if (tcr->tcLJ[i].bPrint) + { + xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])), + leg); + } + } + } + } +} + +void +do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t, + int step, real ener[], t_forcerec * fr, t_inputrec * ir, + int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver, + int nmols, t_commrec * cr, matrix box, tensor virial, + tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt) +{ + int i, j, ati, atj, atnr2, type, ftype; + real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf; + real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind; + int bTest, bPrint; + t_coupl_iparams *tip; + if (bPrint) + { + pr_ff (tcr, t, idef, cr, nfile, fnm); + } + for (i = 0; (i < eoObsNR); i++) + { + deviation[i] = + calc_deviation (tcr->av_value[i], tcr->act_value[i], + tcr->ref_value[i]); + prdev[i] = tcr->ref_value[i] - tcr->act_value[i]; + } + if (bPrint) + pr_dev (tcr, t, prdev, cr, nfile, fnm); + for (i = 0; (i < atnr2); i++) + { + factor = dt * deviation[tip->eObs]; + switch (ftype) + { + case F_BONDS: + if (fabs (tip->xi.harmonic.krA) > 1.2e-38) + idef->iparams[type].harmonic.krA *= + (1 + factor / tip->xi.harmonic.krA); + } + } +} -- cgit v1.2.3 From a6bc6414b9a03693506111fabc23711eb0d4ec90 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 17 Oct 2013 20:08:21 +0000 Subject: compiler: Rework handling of imported anonymous builtin types again. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203794 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/types.cc | 74 ++++++++++++++++++++++++---------------------- gcc/go/gofrontend/types.h | 13 +++++++- 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index c13bfea438d..59247d6fb05 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -4209,7 +4209,8 @@ Struct_field::is_field_name(const std::string& name) const // This is a horrible hack caused by the fact that we don't pack // the names of builtin types. FIXME. - if (nt != NULL + if (!this->is_imported_ + && nt != NULL && nt->is_builtin() && nt->name() == Gogo::unpack_hidden_name(name)) return true; @@ -4218,6 +4219,36 @@ Struct_field::is_field_name(const std::string& name) const } } +// Return whether this field is an unexported field named NAME. + +bool +Struct_field::is_unexported_field_name(Gogo* gogo, + const std::string& name) const +{ + const std::string& field_name(this->field_name()); + if (Gogo::is_hidden_name(field_name) + && name == Gogo::unpack_hidden_name(field_name) + && gogo->pack_hidden_name(name, false) != field_name) + return true; + + // Check for the name of a builtin type. This is like the test in + // is_field_name, only there we return false if this->is_imported_, + // and here we return true. + if (this->is_imported_ && this->is_anonymous()) + { + Type* t = this->typed_identifier_.type(); + if (t->points_to() != NULL) + t = t->points_to(); + Named_type* nt = t->named_type(); + if (nt != NULL + && nt->is_builtin() + && nt->name() == Gogo::unpack_hidden_name(name)) + return true; + } + + return false; +} + // Return whether this field is an embedded built-in type. bool @@ -4650,13 +4681,8 @@ Struct_type::is_unexported_local_field(Gogo* gogo, for (Struct_field_list::const_iterator pf = fields->begin(); pf != fields->end(); ++pf) - { - const std::string& field_name(pf->field_name()); - if (Gogo::is_hidden_name(field_name) - && name == Gogo::unpack_hidden_name(field_name) - && gogo->pack_hidden_name(name, false) != field_name) - return true; - } + if (pf->is_unexported_field_name(gogo, name)) + return true; } return false; } @@ -5258,34 +5284,8 @@ Struct_type::do_import(Import* imp) } Type* ftype = imp->read_type(); - // We don't pack the names of builtin types. In - // Struct_field::is_field_name we cope with a hack. Now we - // need another hack so that we don't accidentally think - // that an embedded builtin type is accessible from another - // package (we know that all the builtin types are not - // exported). - // This is called during parsing, before anything is - // lowered, so we have to be careful to avoid dereferencing - // an unknown type name. - if (name.empty()) - { - Type *t = ftype; - if (t->classification() == Type::TYPE_POINTER) - { - // Very ugly. - Pointer_type* ptype = static_cast(t); - t = ptype->points_to(); - } - std::string tname; - if (t->forward_declaration_type() != NULL) - tname = t->forward_declaration_type()->name(); - else if (t->named_type() != NULL) - tname = t->named_type()->name(); - if (!tname.empty() && tname[0] >= 'a' && tname[0] <= 'z') - name = '.' + imp->package()->pkgpath() + '.' + tname; - } - Struct_field sf(Typed_identifier(name, ftype, imp->location())); + sf.set_is_imported(); if (imp->peek_char() == ' ') { @@ -9327,7 +9327,9 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr, else { bool is_unexported; - if (!Gogo::is_hidden_name(name)) + // The test for 'a' and 'z' is to handle builtin names, + // which are not hidden. + if (!Gogo::is_hidden_name(name) && (name[0] < 'a' || name[0] > 'z')) is_unexported = false; else { diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index 928c593a919..ed01d9cdc38 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -1924,7 +1924,7 @@ class Struct_field { public: explicit Struct_field(const Typed_identifier& typed_identifier) - : typed_identifier_(typed_identifier), tag_(NULL) + : typed_identifier_(typed_identifier), tag_(NULL), is_imported_(false) { } // The field name. @@ -1935,6 +1935,10 @@ class Struct_field bool is_field_name(const std::string& name) const; + // Return whether this struct field is an unexported field named NAME. + bool + is_unexported_field_name(Gogo*, const std::string& name) const; + // Return whether this struct field is an embedded built-in type. bool is_embedded_builtin(Gogo*) const; @@ -1972,6 +1976,11 @@ class Struct_field set_tag(const std::string& tag) { this->tag_ = new std::string(tag); } + // Record that this field is defined in an imported struct. + void + set_is_imported() + { this->is_imported_ = true; } + // Set the type. This is only used in error cases. void set_type(Type* type) @@ -1982,6 +1991,8 @@ class Struct_field Typed_identifier typed_identifier_; // The field tag. This is NULL if the field has no tag. std::string* tag_; + // Whether this field is defined in an imported struct. + bool is_imported_; }; // A list of struct fields. -- cgit v1.2.3 From f324f11bcd0d6147ab09597194b7edd6b54ba6d7 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 17 Oct 2013 23:10:31 +0000 Subject: [gcc] 2013-10-17 Michael Meissner Backport from mainline 2013-10-17 Michael Meissner * config/rs6000/rs6000.c (enum rs6000_reload_reg_type): Add new fields to the reg_addr array that describes the valid addressing mode for any register, general purpose registers, floating point registers, and Altivec registers. (FIRST_RELOAD_REG_CLASS): Likewise. (LAST_RELOAD_REG_CLASS): Likewise. (struct reload_reg_map_type): Likewise. (reload_reg_map_type): Likewise. (RELOAD_REG_VALID): Likewise. (RELOAD_REG_MULTIPLE): Likewise. (RELOAD_REG_INDEXED): Likewise. (RELOAD_REG_OFFSET): Likewise. (RELOAD_REG_PRE_INCDEC): Likewise. (RELOAD_REG_PRE_MODIFY): Likewise. (reg_addr): Likewise. (mode_supports_pre_incdec_p): New helper functions to say whether a given mode supports PRE_INC, PRE_DEC, and PRE_MODIFY. (mode_supports_pre_modify_p): Likewise. (rs6000_debug_vector_unit): Rearrange the -mdebug=reg output to print the valid address mode bits for each mode. (rs6000_debug_print_mode): Likewise. (rs6000_debug_reg_global): Likewise. (rs6000_setup_reg_addr_masks): New function to set up the address mask bits for each type. (rs6000_init_hard_regno_mode_ok): Use memset to clear arrays. Call rs6000_setup_reg_addr_masks to set up the address mask bits. (rs6000_legitimate_address_p): Use mode_supports_pre_incdec_p and mode_supports_pre_modify_p to determine if PRE_INC, PRE_DEC, and PRE_MODIFY are supported. (rs6000_output_move_128bit): Change to use {src,dest}_vmx_p for altivec registers, instead of {src,dest}_av_p. (rs6000_print_options_internal): Tweak the debug output slightly. Backport from mainline 2013-10-03 Michael Meissner * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2, ceildf2, btruncdf2, instead of vsx_* name. * config/rs6000/vsx.md (vsx_add3): Change arithmetic iterators to only do V2DF and V4SF here. Move the DF code to rs6000.md where it is combined with SF mode. Replace with just 'v' since only vector operations are handled with these insns after moving the DF support to rs6000.md. (vsx_sub3): Likewise. (vsx_mul3): Likewise. (vsx_div3): Likewise. (vsx_fre2): Likewise. (vsx_neg2): Likewise. (vsx_abs2): Likewise. (vsx_nabs2): Likewise. (vsx_smax3): Likewise. (vsx_smin3): Likewise. (vsx_sqrt2): Likewise. (vsx_rsqrte2): Likewise. (vsx_fms4): Likewise. (vsx_nfma4): Likewise. (vsx_copysign3): Likewise. (vsx_btrunc2): Likewise. (vsx_floor2): Likewise. (vsx_ceil2): Likewise. (vsx_smaxsf3): Delete scalar ops that were moved to rs6000.md. (vsx_sminsf3): Likewise. (vsx_fmadf4): Likewise. (vsx_fmsdf4): Likewise. (vsx_nfmadf4): Likewise. (vsx_nfmsdf4): Likewise. (vsx_cmpdf_internal1): Likewise. * config/rs6000/rs6000.h (TARGET_SF_SPE): Define macros to make it simpler to select whether a target has SPE or traditional floating point support in iterators. (TARGET_DF_SPE): Likewise. (TARGET_SF_FPR): Likewise. (TARGET_DF_FPR): Likewise. (TARGET_SF_INSN): Macros to say whether floating point support exists for a given operation for expanders. (TARGET_DF_INSN): Likewise. * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow combining of SF/DF mode operations, using both traditional and VSX registers. (Fvsx): Likewise. (Ff): Likewise. (Fv): Likewise. (Fs): Likewise. (Ffre): Likewise. (FFRE): Likewise. (abs2): Combine SF/DF modes using traditional floating point instructions. Add support for using the upper DF registers with VSX support, and SF registers with power8-vector support. Update expanders for operations supported by both the SPE and traditional floating point units. (abs2_fpr): Likewise. (nabs2): Likewise. (nabs2_fpr): Likewise. (neg2): Likewise. (neg2_fpr): Likewise. (add3): Likewise. (add3_fpr): Likewise. (sub3): Likewise. (sub3_fpr): Likewise. (mul3): Likewise. (mul3_fpr): Likewise. (div3): Likewise. (div3_fpr): Likewise. (sqrt3): Likewise. (sqrt3_fpr): Likewise. (fre): Likewise. (rsqrt2): Likewise. (cmp_fpr): Likewise. (smax3): Likewise. (smin3): Likewise. (smax3_vsx): Likewise. (smin3_vsx): Likewise. (negsf2): Delete SF operations that are merged with DF. (abssf2): Likewise. (addsf3): Likewise. (subsf3): Likewise. (mulsf3): Likewise. (divsf3): Likewise. (fres): Likewise. (fmasf4_fpr): Likewise. (fmssf4_fpr): Likewise. (nfmasf4_fpr): Likewise. (nfmssf4_fpr): Likewise. (sqrtsf2): Likewise. (rsqrtsf_internal1): Likewise. (smaxsf3): Likewise. (sminsf3): Likewise. (cmpsf_internal1): Likewise. (copysign3_fcpsgn): Add VSX/power8-vector support. (negdf2): Delete DF operations that are merged with SF. (absdf2): Likewise. (nabsdf2): Likewise. (adddf3): Likewise. (subdf3): Likewise. (muldf3): Likewise. (divdf3): Likewise. (fred): Likewise. (rsqrtdf_internal1): Likewise. (fmadf4_fpr): Likewise. (fmsdf4_fpr): Likewise. (nfmadf4_fpr): Likewise. (nfmsdf4_fpr): Likewise. (sqrtdf2): Likewise. (smaxdf3): Likewise. (smindf3): Likewise. (cmpdf_internal1): Likewise. (lrintdi2): Use TARGET__FPR macro. (btrunc2): Delete separate expander, and combine with the insn and add VSX instruction support. Use TARGET__FPR. (btrunc2_fpr): Likewise. (ceil2): Likewise. (ceil2_fpr): Likewise. (floor2): Likewise. (floor2_fpr): Likewise. (fma4_fpr): Combine SF and DF fused multiply/add support. Add support for using the upper registers with VSX and power8-vector. Move insns to be closer to the define_expands. On VSX systems, prefer the traditional form of FMA over the VSX version, since the traditional form allows the target not to overlap with the inputs. (fms4_fpr): Likewise. (nfma4_fpr): Likewise. (nfms4_fpr): Likewise. Backport from mainline 2013-09-27 Michael Meissner * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow DFmode, DImode, and SFmode in the upper VSX registers based on the -mupper-regs-{df,sf} flags. Fix wu constraint to be ALTIVEC_REGS if -mpower8-vector. Combine -mvsx-timode handling with the rest of the VSX register handling. * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters. (f32_sv): Likewise. (zero_extendsidi2_lfiwzx): Add support for loading into the Altivec registers with -mpower8-vector. Use wu/wv constraints to only do VSX memory options on Altivec registers. (extendsidi2_lfiwax): Likewise. (extendsfdf2_fpr): Likewise. (mov_hardfloat, SF/SD modes): Likewise. (mov_hardfloat32, DF/DD modes): Likewise. (mov_hardfloat64, DF/DD modes): Likewise. (movdi_internal64): Likewise. Backport from mainline 2013-09-23 Michael Meissner * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine reload helper function arrays into a single array reg_addr. (reload_fpr_gpr): Likewise. (reload_gpr_vsx): Likewise. (reload_vsx_gpr): Likewise. (struct rs6000_reg_addr): Likewise. (reg_addr): Likewise. (rs6000_debug_reg_global): Change rs6000_vector_reload, reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr. (rs6000_init_hard_regno_mode_ok): Likewise. (rs6000_secondary_reload_direct_move): Likewise. (rs6000_secondary_reload): Likewise. * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new constraints: wu, ww, and wy. Repurpose wv constraint added during power8 changes. Put wg constraint in alphabetical order. * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch for future work to add ISA 2.07 VSX single precision support. (-mvsx-scalar-double): Change default from -1 to 1, update documentation comment. (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df. (-mupper-regs-df): New debug switch to control whether DF values can go in the traditional Altivec registers. (-mupper-regs-sf): New debug switch to control whether SF values can go in the traditional Altivec registers. * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww, and wy constraints. (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for loop variables. Rename -mvsx-scalar-memory to -mupper-regs-df. Add new constraints, wu/ww/wy. Repurpose wv constraint. (rs6000_debug_legitimate_address_p): Print if we are running before, during, or after reload. (rs6000_secondary_reload): Add a comment. (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf. * config/rs6000/constraints.md (wa constraint): Sort w constraints. Update documentation string. (wd constraint): Likewise. (wf constraint): Likewise. (wg constraint): Likewise. (wn constraint): Likewise. (ws constraint): Likewise. (wt constraint): Likewise. (wx constraint): Likewise. (wz constraint): Likewise. (wu constraint): New constraint for ISA 2.07 SFmode scalar instructions. (ww constraint): Likewise. (wy constraint): Likewise. (wv constraint): Repurpose ISA 2.07 constraint that did not use in the previous submissions. * doc/md.texi (PowerPC and IBM RS6000): Likewise. [gcc/testsuite] 2013-10-17 Michael Meissner Back port from mainline 2013-10-03 Michael Meissner * gcc.target/powerpc/p8vector-fp.c: New test for floating point scalar operations when using -mupper-regs-sf and -mupper-regs-df. * gcc.target/powerpc/ppc-target-1.c: Update tests to allow either VSX scalar operations or the traditional floating point form of the instruction. * gcc.target/powerpc/ppc-target-2.c: Likewise. * gcc.target/powerpc/recip-3.c: Likewise. * gcc.target/powerpc/recip-5.c: Likewise. * gcc.target/powerpc/pr72747.c: Likewise. * gcc.target/powerpc/vsx-builtin-3.c: Likewise. Back port from mainline 2013-09-27 Michael Meissner * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf and -mupper-regs-df. Back port from mainline 2013-10-17 Michael Meissner git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@203804 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.ibm | 249 +++++++ gcc/config/rs6000/constraints.md | 52 +- gcc/config/rs6000/rs6000-builtin.def | 6 +- gcc/config/rs6000/rs6000.c | 616 +++++++++++----- gcc/config/rs6000/rs6000.h | 26 +- gcc/config/rs6000/rs6000.md | 883 ++++++++++------------- gcc/config/rs6000/rs6000.opt | 19 +- gcc/config/rs6000/vsx.md | 246 ++----- gcc/doc/md.texi | 36 +- gcc/testsuite/ChangeLog.ibm | 20 + gcc/testsuite/gcc.target/powerpc/p8vector-fp.c | 139 ++++ gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c | 42 ++ gcc/testsuite/gcc.target/powerpc/ppc-target-1.c | 3 +- gcc/testsuite/gcc.target/powerpc/ppc-target-2.c | 3 +- gcc/testsuite/gcc.target/powerpc/pr42747.c | 2 +- gcc/testsuite/gcc.target/powerpc/recip-3.c | 12 +- gcc/testsuite/gcc.target/powerpc/recip-5.c | 4 +- gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c | 6 +- 18 files changed, 1427 insertions(+), 937 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/p8vector-fp.c create mode 100644 gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index a5f3b06f6fb..b4b88e206e2 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -3,6 +3,255 @@ Backport from mainline 2013-10-17 Michael Meissner + * config/rs6000/rs6000.c (enum rs6000_reload_reg_type): Add new + fields to the reg_addr array that describes the valid addressing + mode for any register, general purpose registers, floating point + registers, and Altivec registers. + (FIRST_RELOAD_REG_CLASS): Likewise. + (LAST_RELOAD_REG_CLASS): Likewise. + (struct reload_reg_map_type): Likewise. + (reload_reg_map_type): Likewise. + (RELOAD_REG_VALID): Likewise. + (RELOAD_REG_MULTIPLE): Likewise. + (RELOAD_REG_INDEXED): Likewise. + (RELOAD_REG_OFFSET): Likewise. + (RELOAD_REG_PRE_INCDEC): Likewise. + (RELOAD_REG_PRE_MODIFY): Likewise. + (reg_addr): Likewise. + (mode_supports_pre_incdec_p): New helper functions to say whether + a given mode supports PRE_INC, PRE_DEC, and PRE_MODIFY. + (mode_supports_pre_modify_p): Likewise. + (rs6000_debug_vector_unit): Rearrange the -mdebug=reg output to + print the valid address mode bits for each mode. + (rs6000_debug_print_mode): Likewise. + (rs6000_debug_reg_global): Likewise. + (rs6000_setup_reg_addr_masks): New function to set up the address + mask bits for each type. + (rs6000_init_hard_regno_mode_ok): Use memset to clear arrays. + Call rs6000_setup_reg_addr_masks to set up the address mask bits. + (rs6000_legitimate_address_p): Use mode_supports_pre_incdec_p and + mode_supports_pre_modify_p to determine if PRE_INC, PRE_DEC, and + PRE_MODIFY are supported. + (rs6000_output_move_128bit): Change to use {src,dest}_vmx_p for altivec + registers, instead of {src,dest}_av_p. + (rs6000_print_options_internal): Tweak the debug output slightly. + + Backport from mainline + 2013-10-03 Michael Meissner + + * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2, + ceildf2, btruncdf2, instead of vsx_* name. + + * config/rs6000/vsx.md (vsx_add3): Change arithmetic + iterators to only do V2DF and V4SF here. Move the DF code to + rs6000.md where it is combined with SF mode. Replace with + just 'v' since only vector operations are handled with these insns + after moving the DF support to rs6000.md. + (vsx_sub3): Likewise. + (vsx_mul3): Likewise. + (vsx_div3): Likewise. + (vsx_fre2): Likewise. + (vsx_neg2): Likewise. + (vsx_abs2): Likewise. + (vsx_nabs2): Likewise. + (vsx_smax3): Likewise. + (vsx_smin3): Likewise. + (vsx_sqrt2): Likewise. + (vsx_rsqrte2): Likewise. + (vsx_fms4): Likewise. + (vsx_nfma4): Likewise. + (vsx_copysign3): Likewise. + (vsx_btrunc2): Likewise. + (vsx_floor2): Likewise. + (vsx_ceil2): Likewise. + (vsx_smaxsf3): Delete scalar ops that were moved to rs6000.md. + (vsx_sminsf3): Likewise. + (vsx_fmadf4): Likewise. + (vsx_fmsdf4): Likewise. + (vsx_nfmadf4): Likewise. + (vsx_nfmsdf4): Likewise. + (vsx_cmpdf_internal1): Likewise. + + * config/rs6000/rs6000.h (TARGET_SF_SPE): Define macros to make it + simpler to select whether a target has SPE or traditional floating + point support in iterators. + (TARGET_DF_SPE): Likewise. + (TARGET_SF_FPR): Likewise. + (TARGET_DF_FPR): Likewise. + (TARGET_SF_INSN): Macros to say whether floating point support + exists for a given operation for expanders. + (TARGET_DF_INSN): Likewise. + + * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow + combining of SF/DF mode operations, using both traditional and VSX + registers. + (Fvsx): Likewise. + (Ff): Likewise. + (Fv): Likewise. + (Fs): Likewise. + (Ffre): Likewise. + (FFRE): Likewise. + (abs2): Combine SF/DF modes using traditional floating point + instructions. Add support for using the upper DF registers with + VSX support, and SF registers with power8-vector support. Update + expanders for operations supported by both the SPE and traditional + floating point units. + (abs2_fpr): Likewise. + (nabs2): Likewise. + (nabs2_fpr): Likewise. + (neg2): Likewise. + (neg2_fpr): Likewise. + (add3): Likewise. + (add3_fpr): Likewise. + (sub3): Likewise. + (sub3_fpr): Likewise. + (mul3): Likewise. + (mul3_fpr): Likewise. + (div3): Likewise. + (div3_fpr): Likewise. + (sqrt3): Likewise. + (sqrt3_fpr): Likewise. + (fre): Likewise. + (rsqrt2): Likewise. + (cmp_fpr): Likewise. + (smax3): Likewise. + (smin3): Likewise. + (smax3_vsx): Likewise. + (smin3_vsx): Likewise. + (negsf2): Delete SF operations that are merged with DF. + (abssf2): Likewise. + (addsf3): Likewise. + (subsf3): Likewise. + (mulsf3): Likewise. + (divsf3): Likewise. + (fres): Likewise. + (fmasf4_fpr): Likewise. + (fmssf4_fpr): Likewise. + (nfmasf4_fpr): Likewise. + (nfmssf4_fpr): Likewise. + (sqrtsf2): Likewise. + (rsqrtsf_internal1): Likewise. + (smaxsf3): Likewise. + (sminsf3): Likewise. + (cmpsf_internal1): Likewise. + (copysign3_fcpsgn): Add VSX/power8-vector support. + (negdf2): Delete DF operations that are merged with SF. + (absdf2): Likewise. + (nabsdf2): Likewise. + (adddf3): Likewise. + (subdf3): Likewise. + (muldf3): Likewise. + (divdf3): Likewise. + (fred): Likewise. + (rsqrtdf_internal1): Likewise. + (fmadf4_fpr): Likewise. + (fmsdf4_fpr): Likewise. + (nfmadf4_fpr): Likewise. + (nfmsdf4_fpr): Likewise. + (sqrtdf2): Likewise. + (smaxdf3): Likewise. + (smindf3): Likewise. + (cmpdf_internal1): Likewise. + (lrintdi2): Use TARGET__FPR macro. + (btrunc2): Delete separate expander, and combine with the + insn and add VSX instruction support. Use TARGET__FPR. + (btrunc2_fpr): Likewise. + (ceil2): Likewise. + (ceil2_fpr): Likewise. + (floor2): Likewise. + (floor2_fpr): Likewise. + (fma4_fpr): Combine SF and DF fused multiply/add support. + Add support for using the upper registers with VSX and + power8-vector. Move insns to be closer to the define_expands. On + VSX systems, prefer the traditional form of FMA over the VSX + version, since the traditional form allows the target not to + overlap with the inputs. + (fms4_fpr): Likewise. + (nfma4_fpr): Likewise. + (nfms4_fpr): Likewise. + + Backport from mainline + 2013-09-27 Michael Meissner + + * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow + DFmode, DImode, and SFmode in the upper VSX registers based on the + -mupper-regs-{df,sf} flags. Fix wu constraint to be ALTIVEC_REGS + if -mpower8-vector. Combine -mvsx-timode handling with the rest + of the VSX register handling. + + * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters. + (f32_sv): Likewise. + (zero_extendsidi2_lfiwzx): Add support for loading into the + Altivec registers with -mpower8-vector. Use wu/wv constraints to + only do VSX memory options on Altivec registers. + (extendsidi2_lfiwax): Likewise. + (extendsfdf2_fpr): Likewise. + (mov_hardfloat, SF/SD modes): Likewise. + (mov_hardfloat32, DF/DD modes): Likewise. + (mov_hardfloat64, DF/DD modes): Likewise. + (movdi_internal64): Likewise. + + Backport from mainline + 2013-09-23 Michael Meissner + + * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine + reload helper function arrays into a single array reg_addr. + (reload_fpr_gpr): Likewise. + (reload_gpr_vsx): Likewise. + (reload_vsx_gpr): Likewise. + (struct rs6000_reg_addr): Likewise. + (reg_addr): Likewise. + (rs6000_debug_reg_global): Change rs6000_vector_reload, + reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr. + (rs6000_init_hard_regno_mode_ok): Likewise. + (rs6000_secondary_reload_direct_move): Likewise. + (rs6000_secondary_reload): Likewise. + + * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new + constraints: wu, ww, and wy. Repurpose wv constraint added during + power8 changes. Put wg constraint in alphabetical order. + + * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch + for future work to add ISA 2.07 VSX single precision support. + (-mvsx-scalar-double): Change default from -1 to 1, update + documentation comment. + (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df. + (-mupper-regs-df): New debug switch to control whether DF values + can go in the traditional Altivec registers. + (-mupper-regs-sf): New debug switch to control whether SF values + can go in the traditional Altivec registers. + + * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww, + and wy constraints. + (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for + loop variables. Rename -mvsx-scalar-memory to -mupper-regs-df. + Add new constraints, wu/ww/wy. Repurpose wv constraint. + (rs6000_debug_legitimate_address_p): Print if we are running + before, during, or after reload. + (rs6000_secondary_reload): Add a comment. + (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf. + + * config/rs6000/constraints.md (wa constraint): Sort w + constraints. Update documentation string. + (wd constraint): Likewise. + (wf constraint): Likewise. + (wg constraint): Likewise. + (wn constraint): Likewise. + (ws constraint): Likewise. + (wt constraint): Likewise. + (wx constraint): Likewise. + (wz constraint): Likewise. + (wu constraint): New constraint for ISA 2.07 SFmode scalar + instructions. + (ww constraint): Likewise. + (wy constraint): Likewise. + (wv constraint): Repurpose ISA 2.07 constraint that did not use in + the previous submissions. + * doc/md.texi (PowerPC and IBM RS6000): Likewise. + + Backport from mainline + 2013-10-17 Michael Meissner + PR target/58673 * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only restrict TImode addresses to single indirect registers if both diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md index fa53cbb9de7..4467b9e3d8b 100644 --- a/gcc/config/rs6000/constraints.md +++ b/gcc/config/rs6000/constraints.md @@ -52,29 +52,18 @@ "@internal") ;; Use w as a prefix to add VSX modes -;; vector double (V2DF) +;; any VSX register +(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]" + "Any VSX register if the -mvsx option was used or NO_REGS.") + (define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]" - "@internal") + "VSX vector register to hold vector double data or NO_REGS.") -;; vector float (V4SF) (define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]" - "@internal") - -;; scalar double (DF) -(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]" - "@internal") - -;; TImode in VSX registers -(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]" - "@internal") - -;; any VSX register -(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]" - "@internal") + "VSX vector register to hold vector float data or NO_REGS.") -;; Register constraints to simplify move patterns (define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]" - "Floating point register if -mmfpgpr is used, or NO_REGS.") + "If -mmfpgpr was used, a floating point register or NO_REGS.") (define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]" "Floating point register if the LFIWAX instruction is enabled or NO_REGS.") @@ -82,23 +71,38 @@ (define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]" "VSX register if direct move instructions are enabled, or NO_REGS.") +;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use +;; direct move directly, and movsf can't to move between the register sets. +;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode +(define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).") + (define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]" "General purpose register if 64-bit instructions are enabled or NO_REGS.") +(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]" + "VSX vector register to hold scalar double values or NO_REGS.") + +(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]" + "VSX vector register to hold 128 bit integer or NO_REGS.") + +(define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]" + "Altivec register to use for float/32-bit int loads/stores or NO_REGS.") + (define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]" - "Altivec register if -mpower8-vector is used or NO_REGS.") + "Altivec register to use for double loads/stores or NO_REGS.") + +(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]" + "FP or VSX register to perform float operations under -mvsx or NO_REGS.") (define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]" "Floating point register if the STFIWX instruction is enabled or NO_REGS.") +(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]" + "VSX vector register to hold scalar float values or NO_REGS.") + (define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]" "Floating point register if the LFIWZX instruction is enabled or NO_REGS.") -;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use -;; direct move directly, and movsf can't to move between the register sets. -;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode -(define_register_constraint "wn" "NO_REGS") - ;; Lq/stq validates the address for load/store quad (define_memory_constraint "wQ" "Memory operand suitable for the load/store quad instructions" diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 672604406d5..3dab7321cac 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -1209,9 +1209,9 @@ BU_VSX_1 (XVRSPIZ, "xvrspiz", CONST, vsx_btruncv4sf2) BU_VSX_1 (XSRDPI, "xsrdpi", CONST, vsx_xsrdpi) BU_VSX_1 (XSRDPIC, "xsrdpic", CONST, vsx_xsrdpic) -BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, vsx_floordf2) -BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, vsx_ceildf2) -BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, vsx_btruncdf2) +BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, floordf2) +BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, ceildf2) +BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, btruncdf2) /* VSX predicate functions. */ BU_VSX_P (XVCMPEQSP_P, "xvcmpeqsp_p", CONST, vector_eq_v4sf_p) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index dab5c766a59..891cabd2a39 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -189,9 +189,6 @@ unsigned char rs6000_hard_regno_nregs[NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER]; /* Map register number to register class. */ enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER]; -/* Reload functions based on the type and the vector unit. */ -static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2]; - static int dbg_cost_ctrl; /* Built in types. */ @@ -319,11 +316,77 @@ static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES]; #define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE) -/* Direct moves to/from vsx/gpr registers that need an additional register to - do the move. */ -static enum insn_code reload_fpr_gpr[NUM_MACHINE_MODES]; -static enum insn_code reload_gpr_vsx[NUM_MACHINE_MODES]; -static enum insn_code reload_vsx_gpr[NUM_MACHINE_MODES]; + +/* Register classes we care about in secondary reload or go if legitimate + address. We only need to worry about GPR, FPR, and Altivec registers here, + along an ANY field that is the OR of the 3 register classes. */ + +enum rs6000_reload_reg_type { + RELOAD_REG_GPR, /* General purpose registers. */ + RELOAD_REG_FPR, /* Traditional floating point regs. */ + RELOAD_REG_VMX, /* Altivec (VMX) registers. */ + RELOAD_REG_ANY, /* OR of GPR, FPR, Altivec masks. */ + N_RELOAD_REG +}; + +/* For setting up register classes, loop through the 3 register classes mapping + into real registers, and skip the ANY class, which is just an OR of the + bits. */ +#define FIRST_RELOAD_REG_CLASS RELOAD_REG_GPR +#define LAST_RELOAD_REG_CLASS RELOAD_REG_VMX + +/* Map reload register type to a register in the register class. */ +struct reload_reg_map_type { + const char *name; /* Register class name. */ + int reg; /* Register in the register class. */ +}; + +static const struct reload_reg_map_type reload_reg_map[N_RELOAD_REG] = { + { "Gpr", FIRST_GPR_REGNO }, /* RELOAD_REG_GPR. */ + { "Fpr", FIRST_FPR_REGNO }, /* RELOAD_REG_FPR. */ + { "VMX", FIRST_ALTIVEC_REGNO }, /* RELOAD_REG_VMX. */ + { "Any", -1 }, /* RELOAD_REG_ANY. */ +}; + +/* Mask bits for each register class, indexed per mode. Historically the + compiler has been more restrictive which types can do PRE_MODIFY instead of + PRE_INC and PRE_DEC, so keep track of sepaate bits for these two. */ +typedef unsigned char addr_mask_type; + +#define RELOAD_REG_VALID 0x01 /* Mode valid in register.. */ +#define RELOAD_REG_MULTIPLE 0x02 /* Mode takes multiple registers. */ +#define RELOAD_REG_INDEXED 0x04 /* Reg+reg addressing. */ +#define RELOAD_REG_OFFSET 0x08 /* Reg+offset addressing. */ +#define RELOAD_REG_PRE_INCDEC 0x10 /* PRE_INC/PRE_DEC valid. */ +#define RELOAD_REG_PRE_MODIFY 0x20 /* PRE_MODIFY valid. */ + +/* Register type masks based on the type, of valid addressing modes. */ +struct rs6000_reg_addr { + enum insn_code reload_load; /* INSN to reload for loading. */ + enum insn_code reload_store; /* INSN to reload for storing. */ + enum insn_code reload_fpr_gpr; /* INSN to move from FPR to GPR. */ + enum insn_code reload_gpr_vsx; /* INSN to move from GPR to VSX. */ + enum insn_code reload_vsx_gpr; /* INSN to move from VSX to GPR. */ + addr_mask_type addr_mask[(int)N_RELOAD_REG]; /* Valid address masks. */ +}; + +static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES]; + +/* Helper function to say whether a mode supports PRE_INC or PRE_DEC. */ +static inline bool +mode_supports_pre_incdec_p (enum machine_mode mode) +{ + return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC) + != 0); +} + +/* Helper function to say whether a mode supports PRE_MODIFY. */ +static inline bool +mode_supports_pre_modify_p (enum machine_mode mode) +{ + return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY) + != 0); +} /* Target cpu costs. */ @@ -1630,19 +1693,28 @@ rs6000_hard_regno_mode_ok (int regno, enum machine_mode mode) /* VSX registers that overlap the FPR registers are larger than for non-VSX implementations. Don't allow an item to be split between a FP register - and an Altivec register. */ - if (VECTOR_MEM_VSX_P (mode)) + and an Altivec register. Allow TImode in all VSX registers if the user + asked for it. */ + if (TARGET_VSX && VSX_REGNO_P (regno) + && (VECTOR_MEM_VSX_P (mode) + || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode) + || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode)) + || (TARGET_VSX_TIMODE && mode == TImode))) { if (FP_REGNO_P (regno)) return FP_REGNO_P (last_regno); if (ALTIVEC_REGNO_P (regno)) - return ALTIVEC_REGNO_P (last_regno); - } + { + if (mode == SFmode && !TARGET_UPPER_REGS_SF) + return 0; - /* Allow TImode in all VSX registers if the user asked for it. */ - if (mode == TImode && TARGET_VSX_TIMODE && VSX_REGNO_P (regno)) - return 1; + if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF) + return 0; + + return ALTIVEC_REGNO_P (last_regno); + } + } /* The GPRs can hold any mode, but values bigger than one register cannot go past R31. */ @@ -1772,6 +1844,63 @@ rs6000_debug_reg_print (int first_regno, int last_regno, const char *reg_name) } } +static const char * +rs6000_debug_vector_unit (enum rs6000_vector v) +{ + const char *ret; + + switch (v) + { + case VECTOR_NONE: ret = "none"; break; + case VECTOR_ALTIVEC: ret = "altivec"; break; + case VECTOR_VSX: ret = "vsx"; break; + case VECTOR_P8_VECTOR: ret = "p8_vector"; break; + case VECTOR_PAIRED: ret = "paired"; break; + case VECTOR_SPE: ret = "spe"; break; + case VECTOR_OTHER: ret = "other"; break; + default: ret = "unknown"; break; + } + + return ret; +} + +/* Print the address masks in a human readble fashion. */ +DEBUG_FUNCTION void +rs6000_debug_print_mode (ssize_t m) +{ + ssize_t rc; + + fprintf (stderr, "Mode: %-5s", GET_MODE_NAME (m)); + for (rc = 0; rc < N_RELOAD_REG; rc++) + { + addr_mask_type mask = reg_addr[m].addr_mask[rc]; + fprintf (stderr, + " %s: %c%c%c%c%c%c", + reload_reg_map[rc].name, + (mask & RELOAD_REG_VALID) != 0 ? 'v' : ' ', + (mask & RELOAD_REG_MULTIPLE) != 0 ? 'm' : ' ', + (mask & RELOAD_REG_INDEXED) != 0 ? 'i' : ' ', + (mask & RELOAD_REG_OFFSET) != 0 ? 'o' : ' ', + (mask & RELOAD_REG_PRE_INCDEC) != 0 ? '+' : ' ', + (mask & RELOAD_REG_PRE_MODIFY) != 0 ? '+' : ' '); + } + + if (rs6000_vector_unit[m] != VECTOR_NONE + || rs6000_vector_mem[m] != VECTOR_NONE + || (reg_addr[m].reload_store != CODE_FOR_nothing) + || (reg_addr[m].reload_load != CODE_FOR_nothing)) + { + fprintf (stderr, + " Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c", + rs6000_debug_vector_unit (rs6000_vector_unit[m]), + rs6000_debug_vector_unit (rs6000_vector_mem[m]), + (reg_addr[m].reload_store != CODE_FOR_nothing) ? 's' : '*', + (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*'); + } + + fputs ("\n", stderr); +} + #define DEBUG_FMT_ID "%-32s= " #define DEBUG_FMT_D DEBUG_FMT_ID "%d\n" #define DEBUG_FMT_WX DEBUG_FMT_ID "%#.12" HOST_WIDE_INT_PRINT "x: " @@ -1795,17 +1924,6 @@ rs6000_debug_reg_global (void) const char *cmodel_str; struct cl_target_option cl_opts; - /* Map enum rs6000_vector to string. */ - static const char *rs6000_debug_vector_unit[] = { - "none", - "altivec", - "vsx", - "p8_vector", - "paired", - "spe", - "other" - }; - /* Modes we want tieable information on. */ static const enum machine_mode print_tieable_modes[] = { QImode, @@ -1897,8 +2015,11 @@ rs6000_debug_reg_global (void) "wr reg_class = %s\n" "ws reg_class = %s\n" "wt reg_class = %s\n" + "wu reg_class = %s\n" "wv reg_class = %s\n" + "ww reg_class = %s\n" "wx reg_class = %s\n" + "wy reg_class = %s\n" "wz reg_class = %s\n" "\n", reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_d]], @@ -1913,28 +2034,18 @@ rs6000_debug_reg_global (void) reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]], reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]], reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wu]], reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wv]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ww]], reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]], + reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wy]], reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wz]]); + nl = "\n"; for (m = 0; m < NUM_MACHINE_MODES; ++m) - if (rs6000_vector_unit[m] || rs6000_vector_mem[m] - || (rs6000_vector_reload[m][0] != CODE_FOR_nothing) - || (rs6000_vector_reload[m][1] != CODE_FOR_nothing)) - { - nl = "\n"; - fprintf (stderr, - "Vector mode: %-5s arithmetic: %-10s move: %-10s " - "reload-out: %c reload-in: %c\n", - GET_MODE_NAME (m), - rs6000_debug_vector_unit[ rs6000_vector_unit[m] ], - rs6000_debug_vector_unit[ rs6000_vector_mem[m] ], - (rs6000_vector_reload[m][0] != CODE_FOR_nothing) ? 'y' : 'n', - (rs6000_vector_reload[m][1] != CODE_FOR_nothing) ? 'y' : 'n'); - } + rs6000_debug_print_mode (m); - if (nl) - fputs (nl, stderr); + fputs ("\n", stderr); for (m1 = 0; m1 < ARRAY_SIZE (print_tieable_modes); m1++) { @@ -2170,11 +2281,106 @@ rs6000_debug_reg_global (void) (int)RS6000_BUILTIN_COUNT); } + +/* Update the addr mask bits in reg_addr to help secondary reload and go if + legitimate address support to figure out the appropriate addressing to + use. */ + +static void +rs6000_setup_reg_addr_masks (void) +{ + ssize_t rc, reg, m, nregs; + addr_mask_type any_addr_mask, addr_mask; + + for (m = 0; m < NUM_MACHINE_MODES; ++m) + { + /* SDmode is special in that we want to access it only via REG+REG + addressing on power7 and above, since we want to use the LFIWZX and + STFIWZX instructions to load it. */ + bool indexed_only_p = (m == SDmode && TARGET_NO_SDMODE_STACK); + + any_addr_mask = 0; + for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++) + { + addr_mask = 0; + reg = reload_reg_map[rc].reg; + + /* Can mode values go in the GPR/FPR/Altivec registers? */ + if (reg >= 0 && rs6000_hard_regno_mode_ok_p[m][reg]) + { + nregs = rs6000_hard_regno_nregs[m][reg]; + addr_mask |= RELOAD_REG_VALID; + + /* Indicate if the mode takes more than 1 physical register. If + it takes a single register, indicate it can do REG+REG + addressing. */ + if (nregs > 1 || m == BLKmode) + addr_mask |= RELOAD_REG_MULTIPLE; + else + addr_mask |= RELOAD_REG_INDEXED; + + /* Figure out if we can do PRE_INC, PRE_DEC, or PRE_MODIFY + addressing. Restrict addressing on SPE for 64-bit types + because of the SUBREG hackery used to address 64-bit floats in + '32-bit' GPRs. To simplify secondary reload, don't allow + update forms on scalar floating point types that can go in the + upper registers. */ + + if (TARGET_UPDATE + && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR) + && GET_MODE_SIZE (m) <= 8 + && !VECTOR_MODE_P (m) + && !COMPLEX_MODE_P (m) + && !indexed_only_p + && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m) == 8) + && !(m == DFmode && TARGET_UPPER_REGS_DF) + && !(m == SFmode && TARGET_UPPER_REGS_SF)) + { + addr_mask |= RELOAD_REG_PRE_INCDEC; + + /* PRE_MODIFY is more restricted than PRE_INC/PRE_DEC in that + we don't allow PRE_MODIFY for some multi-register + operations. */ + switch (m) + { + default: + addr_mask |= RELOAD_REG_PRE_MODIFY; + break; + + case DImode: + if (TARGET_POWERPC64) + addr_mask |= RELOAD_REG_PRE_MODIFY; + break; + + case DFmode: + case DDmode: + if (TARGET_DF_INSN) + addr_mask |= RELOAD_REG_PRE_MODIFY; + break; + } + } + } + + /* GPR and FPR registers can do REG+OFFSET addressing, except + possibly for SDmode. */ + if ((addr_mask != 0) && !indexed_only_p + && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR)) + addr_mask |= RELOAD_REG_OFFSET; + + reg_addr[m].addr_mask[rc] = addr_mask; + any_addr_mask |= addr_mask; + } + + reg_addr[m].addr_mask[RELOAD_REG_ANY] = any_addr_mask; + } +} + + /* Initialize the various global tables that are based on register size. */ static void rs6000_init_hard_regno_mode_ok (bool global_init_p) { - int r, m, c; + ssize_t r, m, c; int align64; int align32; @@ -2239,17 +2445,18 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE; } - /* Precalculate vector information, this must be set up before the - rs6000_hard_regno_nregs_internal below. */ - for (m = 0; m < NUM_MACHINE_MODES; ++m) - { - rs6000_vector_unit[m] = rs6000_vector_mem[m] = VECTOR_NONE; - rs6000_vector_reload[m][0] = CODE_FOR_nothing; - rs6000_vector_reload[m][1] = CODE_FOR_nothing; - } + /* Precalculate the valid memory formats as well as the vector information, + this must be set up before the rs6000_hard_regno_nregs_internal calls + below. */ + gcc_assert ((int)VECTOR_NONE == 0); + memset ((void *) &rs6000_vector_unit[0], '\0', sizeof (rs6000_vector_unit)); + memset ((void *) &rs6000_vector_mem[0], '\0', sizeof (rs6000_vector_unit)); + + gcc_assert ((int)CODE_FOR_nothing == 0); + memset ((void *) ®_addr[0], '\0', sizeof (reg_addr)); - for (c = 0; c < (int)(int)RS6000_CONSTRAINT_MAX; c++) - rs6000_constraints[c] = NO_REGS; + gcc_assert ((int)NO_REGS == 0); + memset ((void *) &rs6000_constraints[0], '\0', sizeof (rs6000_constraints)); /* The VSX hardware allows native alignment for vectors, but control whether the compiler believes it can use native alignment or still uses 128-bit alignment. */ @@ -2326,7 +2533,7 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) { rs6000_vector_unit[DFmode] = VECTOR_VSX; rs6000_vector_mem[DFmode] - = (TARGET_VSX_SCALAR_MEMORY ? VECTOR_VSX : VECTOR_NONE); + = (TARGET_UPPER_REGS_DF ? VECTOR_VSX : VECTOR_NONE); rs6000_vector_align[DFmode] = align64; } @@ -2340,7 +2547,34 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) /* TODO add SPE and paired floating point vector support. */ /* Register class constraints for the constraints that depend on compile - switches. */ + switches. When the VSX code was added, different constraints were added + based on the type (DFmode, V2DFmode, V4SFmode). For the vector types, all + of the VSX registers are used. The register classes for scalar floating + point types is set, based on whether we allow that type into the upper + (Altivec) registers. GCC has register classes to target the Altivec + registers for load/store operations, to select using a VSX memory + operation instead of the traditional floating point operation. The + constraints are: + + d - Register class to use with traditional DFmode instructions. + f - Register class to use with traditional SFmode instructions. + v - Altivec register. + wa - Any VSX register. + wd - Preferred register class for V2DFmode. + wf - Preferred register class for V4SFmode. + wg - Float register for power6x move insns. + wl - Float register if we can do 32-bit signed int loads. + wm - VSX register for ISA 2.07 direct move operations. + wr - GPR if 64-bit mode is permitted. + ws - Register class to do ISA 2.06 DF operations. + wu - Altivec register for ISA 2.07 VSX SF/SI load/stores. + wv - Altivec register for ISA 2.06 VSX DF/DI load/stores. + wt - VSX register for TImode in VSX registers. + ww - Register class to do SF conversions in with VSX operations. + wx - Float register if we can do 32-bit int stores. + wy - Register class to do ISA 2.07 SF operations. + wz - Float register if we can do 32-bit unsigned int loads. */ + if (TARGET_HARD_FLOAT && TARGET_FPRS) rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS; @@ -2349,19 +2583,20 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) if (TARGET_VSX) { - /* At present, we just use VSX_REGS, but we have different constraints - based on the use, in case we want to fine tune the default register - class used. wa = any VSX register, wf = register class to use for - V4SF, wd = register class to use for V2DF, and ws = register classs to - use for DF scalars. */ rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS; - rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS; rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS; - rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY - ? VSX_REGS - : FLOAT_REGS); + rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS; + if (TARGET_VSX_TIMODE) rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS; + + if (TARGET_UPPER_REGS_DF) + { + rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS; + rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS; + } + else + rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS; } /* Add conditional constraints based on various options, to allow us to @@ -2381,8 +2616,19 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) if (TARGET_POWERPC64) rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS; - if (TARGET_P8_VECTOR) - rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS; + if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF) + { + rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS; + rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS; + rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS; + } + else if (TARGET_P8_VECTOR) + { + rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS; + rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS; + } + else if (TARGET_VSX) + rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS; if (TARGET_STFIWX) rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS; @@ -2390,112 +2636,104 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) if (TARGET_LFIWZX) rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS; - /* Setup the direct move combinations. */ - for (m = 0; m < NUM_MACHINE_MODES; ++m) - { - reload_fpr_gpr[m] = CODE_FOR_nothing; - reload_gpr_vsx[m] = CODE_FOR_nothing; - reload_vsx_gpr[m] = CODE_FOR_nothing; - } - /* Set up the reload helper and direct move functions. */ if (TARGET_VSX || TARGET_ALTIVEC) { if (TARGET_64BIT) { - rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_di_store; - rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_di_load; - rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_di_store; - rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_di_load; - rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_di_store; - rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_di_load; - rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_di_store; - rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_di_load; - rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_di_store; - rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_di_load; - rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_di_store; - rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_di_load; - if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY) + reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_di_store; + reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_di_load; + reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_di_store; + reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_di_load; + reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_di_store; + reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_di_load; + reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_di_store; + reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_di_load; + reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_di_store; + reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_di_load; + reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_di_store; + reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_di_load; + if (TARGET_VSX && TARGET_UPPER_REGS_DF) { - rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_di_store; - rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_di_load; - rs6000_vector_reload[DDmode][0] = CODE_FOR_reload_dd_di_store; - rs6000_vector_reload[DDmode][1] = CODE_FOR_reload_dd_di_load; + reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store; + reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load; + reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store; + reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load; } if (TARGET_P8_VECTOR) { - rs6000_vector_reload[SFmode][0] = CODE_FOR_reload_sf_di_store; - rs6000_vector_reload[SFmode][1] = CODE_FOR_reload_sf_di_load; - rs6000_vector_reload[SDmode][0] = CODE_FOR_reload_sd_di_store; - rs6000_vector_reload[SDmode][1] = CODE_FOR_reload_sd_di_load; + reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_di_store; + reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_di_load; + reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_di_store; + reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_di_load; } if (TARGET_VSX_TIMODE) { - rs6000_vector_reload[TImode][0] = CODE_FOR_reload_ti_di_store; - rs6000_vector_reload[TImode][1] = CODE_FOR_reload_ti_di_load; + reg_addr[TImode].reload_store = CODE_FOR_reload_ti_di_store; + reg_addr[TImode].reload_load = CODE_FOR_reload_ti_di_load; } if (TARGET_DIRECT_MOVE) { if (TARGET_POWERPC64) { - reload_gpr_vsx[TImode] = CODE_FOR_reload_gpr_from_vsxti; - reload_gpr_vsx[V2DFmode] = CODE_FOR_reload_gpr_from_vsxv2df; - reload_gpr_vsx[V2DImode] = CODE_FOR_reload_gpr_from_vsxv2di; - reload_gpr_vsx[V4SFmode] = CODE_FOR_reload_gpr_from_vsxv4sf; - reload_gpr_vsx[V4SImode] = CODE_FOR_reload_gpr_from_vsxv4si; - reload_gpr_vsx[V8HImode] = CODE_FOR_reload_gpr_from_vsxv8hi; - reload_gpr_vsx[V16QImode] = CODE_FOR_reload_gpr_from_vsxv16qi; - reload_gpr_vsx[SFmode] = CODE_FOR_reload_gpr_from_vsxsf; - - reload_vsx_gpr[TImode] = CODE_FOR_reload_vsx_from_gprti; - reload_vsx_gpr[V2DFmode] = CODE_FOR_reload_vsx_from_gprv2df; - reload_vsx_gpr[V2DImode] = CODE_FOR_reload_vsx_from_gprv2di; - reload_vsx_gpr[V4SFmode] = CODE_FOR_reload_vsx_from_gprv4sf; - reload_vsx_gpr[V4SImode] = CODE_FOR_reload_vsx_from_gprv4si; - reload_vsx_gpr[V8HImode] = CODE_FOR_reload_vsx_from_gprv8hi; - reload_vsx_gpr[V16QImode] = CODE_FOR_reload_vsx_from_gprv16qi; - reload_vsx_gpr[SFmode] = CODE_FOR_reload_vsx_from_gprsf; + reg_addr[TImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxti; + reg_addr[V2DFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2df; + reg_addr[V2DImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2di; + reg_addr[V4SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4sf; + reg_addr[V4SImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4si; + reg_addr[V8HImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hi; + reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi; + reg_addr[SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxsf; + + reg_addr[TImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprti; + reg_addr[V2DFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2df; + reg_addr[V2DImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2di; + reg_addr[V4SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4sf; + reg_addr[V4SImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4si; + reg_addr[V8HImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hi; + reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi; + reg_addr[SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprsf; } else { - reload_fpr_gpr[DImode] = CODE_FOR_reload_fpr_from_gprdi; - reload_fpr_gpr[DDmode] = CODE_FOR_reload_fpr_from_gprdd; - reload_fpr_gpr[DFmode] = CODE_FOR_reload_fpr_from_gprdf; + reg_addr[DImode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdi; + reg_addr[DDmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdd; + reg_addr[DFmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdf; } } } else { - rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_si_store; - rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_si_load; - rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_si_store; - rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_si_load; - rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_si_store; - rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_si_load; - rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_si_store; - rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_si_load; - rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_si_store; - rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_si_load; - rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_si_store; - rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_si_load; - if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY) + reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_si_store; + reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_si_load; + reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_si_store; + reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_si_load; + reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_si_store; + reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_si_load; + reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_si_store; + reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_si_load; + reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_si_store; + reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_si_load; + reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_si_store; + reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_si_load; + if (TARGET_VSX && TARGET_UPPER_REGS_DF) { - rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_si_store; - rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_si_load; - rs6000_vector_reload[DDmode][0] = CODE_FOR_reload_dd_si_store; - rs6000_vector_reload[DDmode][1] = CODE_FOR_reload_dd_si_load; + reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store; + reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load; + reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store; + reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load; } if (TARGET_P8_VECTOR) { - rs6000_vector_reload[SFmode][0] = CODE_FOR_reload_sf_si_store; - rs6000_vector_reload[SFmode][1] = CODE_FOR_reload_sf_si_load; - rs6000_vector_reload[SDmode][0] = CODE_FOR_reload_sd_si_store; - rs6000_vector_reload[SDmode][1] = CODE_FOR_reload_sd_si_load; + reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_si_store; + reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_si_load; + reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_si_store; + reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_si_load; } if (TARGET_VSX_TIMODE) { - rs6000_vector_reload[TImode][0] = CODE_FOR_reload_ti_si_store; - rs6000_vector_reload[TImode][1] = CODE_FOR_reload_ti_si_load; + reg_addr[TImode].reload_store = CODE_FOR_reload_ti_si_store; + reg_addr[TImode].reload_load = CODE_FOR_reload_ti_si_load; } } } @@ -2614,6 +2852,11 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p) } } + /* Update the addr mask bits in reg_addr to help secondary reload and go if + legitimate address support to figure out the appropriate addressing to + use. */ + rs6000_setup_reg_addr_masks (); + if (global_init_p || TARGET_DEBUG_TARGET) { if (TARGET_DEBUG_REG) @@ -7080,17 +7323,9 @@ rs6000_legitimate_address_p (enum machine_mode mode, rtx x, bool reg_ok_strict) return 0; if (legitimate_indirect_address_p (x, reg_ok_strict)) return 1; - if ((GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC) - && !ALTIVEC_OR_VSX_VECTOR_MODE (mode) - && !SPE_VECTOR_MODE (mode) - && mode != TFmode - && mode != TDmode - && mode != TImode - && mode != PTImode - /* Restrict addressing for DI because of our SUBREG hackery. */ - && !(TARGET_E500_DOUBLE - && (mode == DFmode || mode == DDmode || mode == DImode)) - && TARGET_UPDATE + if (TARGET_UPDATE + && (GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC) + && mode_supports_pre_incdec_p (mode) && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict)) return 1; if (virtual_stack_registers_memory_p (x)) @@ -7130,21 +7365,8 @@ rs6000_legitimate_address_p (enum machine_mode mode, rtx x, bool reg_ok_strict) && !avoiding_indexed_address_p (mode) && legitimate_indexed_address_p (x, reg_ok_strict)) return 1; - if (GET_CODE (x) == PRE_MODIFY - && mode != TImode - && mode != PTImode - && mode != TFmode - && mode != TDmode - && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT) - || TARGET_POWERPC64 - || ((mode != DFmode && mode != DDmode) || TARGET_E500_DOUBLE)) - && (TARGET_POWERPC64 || mode != DImode) - && !ALTIVEC_OR_VSX_VECTOR_MODE (mode) - && !SPE_VECTOR_MODE (mode) - /* Restrict addressing for DI because of our SUBREG hackery. */ - && !(TARGET_E500_DOUBLE - && (mode == DFmode || mode == DDmode || mode == DImode)) - && TARGET_UPDATE + if (TARGET_UPDATE && GET_CODE (x) == PRE_MODIFY + && mode_supports_pre_modify_p (mode) && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict) && (rs6000_legitimate_offset_address_p (mode, XEXP (x, 1), reg_ok_strict, false) @@ -7165,10 +7387,13 @@ rs6000_debug_legitimate_address_p (enum machine_mode mode, rtx x, bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict); fprintf (stderr, "\nrs6000_legitimate_address_p: return = %s, mode = %s, " - "strict = %d, code = %s\n", + "strict = %d, reload = %s, code = %s\n", ret ? "true" : "false", GET_MODE_NAME (mode), reg_ok_strict, + (reload_completed + ? "after" + : (reload_in_progress ? "progress" : "before")), GET_RTX_NAME (GET_CODE (x))); debug_rtx (x); @@ -14704,7 +14929,7 @@ rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) /* Classify a register type. Because the FMRGOW/FMRGEW instructions only work on traditional floating point registers, and the VMRGOW/VMRGEW instructions only work on the traditional altivec registers, note if an altivec register - was choosen. */ + was chosen. */ static enum rs6000_reg_type register_to_reg_type (rtx reg, bool *is_altivec) @@ -14801,7 +15026,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) { cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */ - icode = reload_vsx_gpr[(int)mode]; + icode = reg_addr[mode].reload_vsx_gpr; } /* Handle moving 128-bit values from VSX point registers to GPRs on @@ -14810,7 +15035,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) { cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */ - icode = reload_gpr_vsx[(int)mode]; + icode = reg_addr[mode].reload_gpr_vsx; } } @@ -14819,13 +15044,13 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) { cost = 3; /* xscvdpspn, mfvsrd, and. */ - icode = reload_gpr_vsx[(int)mode]; + icode = reg_addr[mode].reload_gpr_vsx; } else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) { cost = 2; /* mtvsrz, xscvspdpn. */ - icode = reload_vsx_gpr[(int)mode]; + icode = reg_addr[mode].reload_vsx_gpr; } } } @@ -14838,7 +15063,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE) { cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */ - icode = reload_vsx_gpr[(int)mode]; + icode = reg_addr[mode].reload_vsx_gpr; } /* Handle moving 128-bit values from VSX point registers to GPRs on @@ -14847,7 +15072,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE) { cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */ - icode = reload_gpr_vsx[(int)mode]; + icode = reg_addr[mode].reload_gpr_vsx; } } @@ -14863,7 +15088,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type, if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE && !altivec_p) { cost = 3; /* 2 mtvsrwz's, 1 fmrgow. */ - icode = reload_fpr_gpr[(int)mode]; + icode = reg_addr[mode].reload_fpr_gpr; } } @@ -14946,7 +15171,9 @@ rs6000_secondary_reload (bool in_p, bool default_p = false; sri->icode = CODE_FOR_nothing; - icode = rs6000_vector_reload[mode][in_p != false]; + icode = ((in_p) + ? reg_addr[mode].reload_load + : reg_addr[mode].reload_store); if (REG_P (x) || register_operand (x, mode)) { @@ -14961,6 +15188,7 @@ rs6000_secondary_reload (bool in_p, from_type = exchange; } + /* Can we do a direct move of some sort? */ if (rs6000_secondary_reload_move (to_type, from_type, mode, sri, altivec_p)) { @@ -15483,7 +15711,7 @@ rs6000_secondary_reload_inner (rtx reg, rtx mem, rtx scratch, bool store_p) /* Adjust the address if it changed. */ if (addr != XEXP (mem, 0)) { - mem = change_address (mem, mode, addr); + mem = replace_equiv_address_nv (mem, addr); if (TARGET_DEBUG_ADDR) fprintf (stderr, "\nrs6000_secondary_reload_inner, mem adjusted.\n"); } @@ -15934,21 +16162,21 @@ rs6000_output_move_128bit (rtx operands[]) enum machine_mode mode = GET_MODE (dest); int dest_regno; int src_regno; - bool dest_gpr_p, dest_fp_p, dest_av_p, dest_vsx_p; - bool src_gpr_p, src_fp_p, src_av_p, src_vsx_p; + bool dest_gpr_p, dest_fp_p, dest_vmx_p, dest_vsx_p; + bool src_gpr_p, src_fp_p, src_vmx_p, src_vsx_p; if (REG_P (dest)) { dest_regno = REGNO (dest); dest_gpr_p = INT_REGNO_P (dest_regno); dest_fp_p = FP_REGNO_P (dest_regno); - dest_av_p = ALTIVEC_REGNO_P (dest_regno); - dest_vsx_p = dest_fp_p | dest_av_p; + dest_vmx_p = ALTIVEC_REGNO_P (dest_regno); + dest_vsx_p = dest_fp_p | dest_vmx_p; } else { dest_regno = -1; - dest_gpr_p = dest_fp_p = dest_av_p = dest_vsx_p = false; + dest_gpr_p = dest_fp_p = dest_vmx_p = dest_vsx_p = false; } if (REG_P (src)) @@ -15956,13 +16184,13 @@ rs6000_output_move_128bit (rtx operands[]) src_regno = REGNO (src); src_gpr_p = INT_REGNO_P (src_regno); src_fp_p = FP_REGNO_P (src_regno); - src_av_p = ALTIVEC_REGNO_P (src_regno); - src_vsx_p = src_fp_p | src_av_p; + src_vmx_p = ALTIVEC_REGNO_P (src_regno); + src_vsx_p = src_fp_p | src_vmx_p; } else { src_regno = -1; - src_gpr_p = src_fp_p = src_av_p = src_vsx_p = false; + src_gpr_p = src_fp_p = src_vmx_p = src_vsx_p = false; } /* Register moves. */ @@ -15986,7 +16214,7 @@ rs6000_output_move_128bit (rtx operands[]) return "#"; } - else if (TARGET_ALTIVEC && dest_av_p && src_av_p) + else if (TARGET_ALTIVEC && dest_vmx_p && src_vmx_p) return "vor %0,%1,%1"; else if (dest_fp_p && src_fp_p) @@ -16004,7 +16232,7 @@ rs6000_output_move_128bit (rtx operands[]) return "#"; } - else if (TARGET_ALTIVEC && dest_av_p + else if (TARGET_ALTIVEC && dest_vmx_p && altivec_indexed_or_indirect_operand (src, mode)) return "lvx %0,%y1"; @@ -16016,7 +16244,7 @@ rs6000_output_move_128bit (rtx operands[]) return "lxvd2x %x0,%y1"; } - else if (TARGET_ALTIVEC && dest_av_p) + else if (TARGET_ALTIVEC && dest_vmx_p) return "lvx %0,%y1"; else if (dest_fp_p) @@ -16034,7 +16262,7 @@ rs6000_output_move_128bit (rtx operands[]) return "#"; } - else if (TARGET_ALTIVEC && src_av_p + else if (TARGET_ALTIVEC && src_vmx_p && altivec_indexed_or_indirect_operand (src, mode)) return "stvx %1,%y0"; @@ -16046,7 +16274,7 @@ rs6000_output_move_128bit (rtx operands[]) return "stxvd2x %x1,%y0"; } - else if (TARGET_ALTIVEC && src_av_p) + else if (TARGET_ALTIVEC && src_vmx_p) return "stvx %1,%y0"; else if (src_fp_p) @@ -16065,7 +16293,7 @@ rs6000_output_move_128bit (rtx operands[]) else if (TARGET_VSX && dest_vsx_p && zero_constant (src, mode)) return "xxlxor %x0,%x0,%x0"; - else if (TARGET_ALTIVEC && dest_av_p) + else if (TARGET_ALTIVEC && dest_vmx_p) return output_vec_const_move (operands); } @@ -29334,6 +29562,8 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] = { "recip-precision", OPTION_MASK_RECIP_PRECISION, false, true }, { "string", OPTION_MASK_STRING, false, true }, { "update", OPTION_MASK_NO_UPDATE, true , true }, + { "upper-regs-df", OPTION_MASK_UPPER_REGS_DF, false, false }, + { "upper-regs-sf", OPTION_MASK_UPPER_REGS_SF, false, false }, { "vsx", OPTION_MASK_VSX, false, true }, { "vsx-timode", OPTION_MASK_VSX_TIMODE, false, true }, #ifdef OPTION_MASK_64BIT @@ -29894,7 +30124,6 @@ rs6000_print_options_internal (FILE *file, size_t cur_column; size_t max_column = 76; const char *comma = ""; - const char *nl = "\n"; if (indent) start_column += fprintf (file, "%*s", indent, ""); @@ -29925,7 +30154,6 @@ rs6000_print_options_internal (FILE *file, fprintf (stderr, ", \\\n%*s", (int)start_column, ""); cur_column = start_column + len; comma = ""; - nl = "\n\n"; } fprintf (file, "%s%s%s%s", comma, prefix, no_str, @@ -29935,7 +30163,7 @@ rs6000_print_options_internal (FILE *file, } } - fputs (nl, file); + fputs ("\n", file); } /* Helper function to print the current isa options on a line. */ diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 59bbc8d6d23..20225099644 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -617,6 +617,25 @@ extern int rs6000_vector_align[]; || rs6000_cpu == PROCESSOR_PPC8548) +/* Whether SF/DF operations are supported on the E500. */ +#define TARGET_SF_SPE (TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT \ + && !TARGET_FPRS) + +#define TARGET_DF_SPE (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT \ + && !TARGET_FPRS && TARGET_E500_DOUBLE) + +/* Whether SF/DF operations are supported by by the normal floating point unit + (or the vector/scalar unit). */ +#define TARGET_SF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \ + && TARGET_SINGLE_FLOAT) + +#define TARGET_DF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \ + && TARGET_DOUBLE_FLOAT) + +/* Whether SF/DF operations are supported by any hardware. */ +#define TARGET_SF_INSN (TARGET_SF_FPR || TARGET_SF_SPE) +#define TARGET_DF_INSN (TARGET_DF_FPR || TARGET_DF_SPE) + /* Which machine supports the various reciprocal estimate instructions. */ #define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \ && TARGET_FPRS && TARGET_SINGLE_FLOAT) @@ -1412,15 +1431,18 @@ enum r6000_reg_class_enum { RS6000_CONSTRAINT_v, /* Altivec registers */ RS6000_CONSTRAINT_wa, /* Any VSX register */ RS6000_CONSTRAINT_wd, /* VSX register for V2DF */ - RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */ RS6000_CONSTRAINT_wf, /* VSX register for V4SF */ + RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */ RS6000_CONSTRAINT_wl, /* FPR register for LFIWAX */ RS6000_CONSTRAINT_wm, /* VSX register for direct move */ RS6000_CONSTRAINT_wr, /* GPR register if 64-bit */ RS6000_CONSTRAINT_ws, /* VSX register for DF */ RS6000_CONSTRAINT_wt, /* VSX register for TImode */ - RS6000_CONSTRAINT_wv, /* Altivec register for power8 vector */ + RS6000_CONSTRAINT_wu, /* Altivec register for float load/stores. */ + RS6000_CONSTRAINT_wv, /* Altivec register for double load/stores. */ + RS6000_CONSTRAINT_ww, /* FP or VSX register for vsx float ops. */ RS6000_CONSTRAINT_wx, /* FPR register for STFIWX */ + RS6000_CONSTRAINT_wy, /* VSX register for SF */ RS6000_CONSTRAINT_wz, /* FPR register for LFIWZX */ RS6000_CONSTRAINT_MAX }; diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 20b4ef32bfc..a513424f68d 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -309,13 +309,13 @@ (define_mode_attr f32_lr [(SF "f") (SD "wz")]) (define_mode_attr f32_lm [(SF "m") (SD "Z")]) (define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")]) -(define_mode_attr f32_lv [(SF "lxsspx %0,%y1") (SD "lxsiwzx %0,%y1")]) +(define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")]) ; Definitions for store from 32-bit fpr register (define_mode_attr f32_sr [(SF "f") (SD "wx")]) (define_mode_attr f32_sm [(SF "m") (SD "Z")]) (define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")]) -(define_mode_attr f32_sv [(SF "stxsspx %1,%y0") (SD "stxsiwzx %1,%y0")]) +(define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")]) ; Definitions for 32-bit fpr direct move (define_mode_attr f32_dm [(SF "wn") (SD "wm")]) @@ -330,6 +330,25 @@ ; Iterator for just SF/DF (define_mode_iterator SFDF [SF DF]) +; SF/DF suffix for traditional floating instructions +(define_mode_attr Ftrad [(SF "s") (DF "")]) + +; SF/DF suffix for VSX instructions +(define_mode_attr Fvsx [(SF "sp") (DF "dp")]) + +; SF/DF constraint for arithmetic on traditional floating point registers +(define_mode_attr Ff [(SF "f") (DF "d")]) + +; SF/DF constraint for arithmetic on VSX registers +(define_mode_attr Fv [(SF "wy") (DF "ws")]) + +; s/d suffix for things like fp_addsub_s/fp_addsub_d +(define_mode_attr Fs [(SF "s") (DF "d")]) + +; FRE/FRES support +(define_mode_attr Ffre [(SF "fres") (DF "fre")]) +(define_mode_attr FFRE [(SF "FRES") (DF "FRE")]) + ; Conditional returns. (define_code_iterator any_return [return simple_return]) (define_code_attr return_pred [(return "direct_return ()") @@ -536,7 +555,7 @@ "") (define_insn "*zero_extendsidi2_lfiwzx" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wm") + [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu") (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))] "TARGET_POWERPC64 && TARGET_LFIWZX" "@ @@ -706,7 +725,7 @@ "") (define_insn "*extendsidi2_lfiwax" - [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wm") + [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu") (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))] "TARGET_POWERPC64 && TARGET_LFIWAX" "@ @@ -4714,22 +4733,172 @@ (const_int 0)))] "") -;; Floating-point insns, excluding normal data motion. -;; -;; PowerPC has a full set of single-precision floating point instructions. -;; -;; For the POWER architecture, we pretend that we have both SFmode and -;; DFmode insns, while, in fact, all fp insns are actually done in double. -;; The only conversions we will do will be when storing to memory. In that -;; case, we will use the "frsp" instruction before storing. -;; -;; Note that when we store into a single-precision memory location, we need to -;; use the frsp insn first. If the register being stored isn't dead, we -;; need a scratch register for the frsp. But this is difficult when the store -;; is done by reload. It is not incorrect to do the frsp on the register in -;; this case, we just lose precision that we would have otherwise gotten but -;; is not guaranteed. Perhaps this should be tightened up at some point. + +;; Floating-point insns, excluding normal data motion. We combine the SF/DF +;; modes here, and also add in conditional vsx/power8-vector support to access +;; values in the traditional Altivec registers if the appropriate +;; -mupper-regs-{df,sf} option is enabled. + +(define_expand "abs2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))] + "TARGET__INSN" + "") + +(define_insn "*abs2_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fabs %0,%1 + xsabsdp %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) + +(define_insn "*nabs2_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (neg:SFDF + (abs:SFDF + (match_operand:SFDF 1 "gpc_reg_operand" ","))))] + "TARGET__FPR" + "@ + fnabs %0,%1 + xsnabsdp %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) + +(define_expand "neg2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))] + "TARGET__INSN" + "") + +(define_insn "*neg2_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fneg %0,%1 + xsnegdp %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) + +(define_expand "add3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")))] + "TARGET__INSN" + "") + +(define_insn "*add3_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%,") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fadd %0,%1,%2 + xsadd %x0,%x1,%x2" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) + +(define_expand "sub3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")))] + "TARGET__INSN" + "") + +(define_insn "*sub3_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" ",") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fsub %0,%1,%2 + xssub %x0,%x1,%x2" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) + +(define_expand "mul3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")))] + "TARGET__INSN" + "") + +(define_insn "*mul3_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%,") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fmul %0,%1,%2 + xsmul %x0,%x1,%x2" + [(set_attr "type" "dmul") + (set_attr "fp_type" "fp_mul_")]) +(define_expand "div3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")))] + "TARGET__INSN && !TARGET_SIMPLE_FPU" + "") + +(define_insn "*div3_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" ",") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR && !TARGET_SIMPLE_FPU" + "@ + fdiv %0,%1,%2 + xsdiv %x0,%x1,%x2" + [(set_attr "type" "div") + (set_attr "fp_type" "fp_div_")]) + +(define_insn "sqrt2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" ",")))] + "TARGET__FPR && !TARGET_SIMPLE_FPU + && (TARGET_PPC_GPOPT || (mode == SFmode && TARGET_XILINX_FPU))" + "@ + fsqrt %0,%1 + xssqrt %x0,%x1" + [(set_attr "type" "sqrt") + (set_attr "fp_type" "fp_sqrt_")]) + +;; Floating point reciprocal approximation +(define_insn "fre" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",")] + UNSPEC_FRES))] + "TARGET_" + "@ + fre %0,%1 + xsre %x0,%x1" + [(set_attr "type" "fp")]) + +(define_insn "*rsqrt2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",")] + UNSPEC_RSQRT))] + "RS6000_RECIP_HAVE_RSQRTE_P (mode)" + "@ + frsqrte %0,%1 + xsrsqrte %x0,%x1" + [(set_attr "type" "fp")]) + +;; Floating point comparisons +(define_insn "*cmp_fpr" + [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y") + (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" ",") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR" + "@ + fcmpu %0,%1,%2 + xscmpudp %x0,%x1,%x2" + [(set_attr "type" "fpcompare")]) + +;; Floating point conversions (define_expand "extendsfdf2" [(set (match_operand:DF 0 "gpc_reg_operand" "") (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))] @@ -4737,13 +4906,16 @@ "") (define_insn_and_split "*extendsfdf2_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d") - (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))] + [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,wy,?wy,wv") + (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wz,Z")))] "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" "@ # fmr %0,%1 - lfs%U1%X1 %0,%1" + lfs%U1%X1 %0,%1 + # + xxlor %x0,%x1,%x1 + lxsspx %x0,%y1" "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])" [(const_int 0)] { @@ -4759,7 +4931,16 @@ (if_then_else (match_test "update_address_mem (operands[1], VOIDmode)") (const_string "fpload_u") - (const_string "fpload")))])]) + (const_string "fpload"))) + (const_string "fp") + (const_string "vecsimple") + (if_then_else + (match_test "update_indexed_address_mem (operands[1], VOIDmode)") + (const_string "fpload_ux") + (if_then_else + (match_test "update_address_mem (operands[1], VOIDmode)") + (const_string "fpload_u") + (const_string "fpload")))])]) (define_expand "truncdfsf2" [(set (match_operand:SF 0 "gpc_reg_operand" "") @@ -4774,175 +4955,6 @@ "frsp %0,%1" [(set_attr "type" "fp")]) -(define_expand "negsf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" - "") - -(define_insn "*negsf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fneg %0,%1" - [(set_attr "type" "fp")]) - -(define_expand "abssf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" - "") - -(define_insn "*abssf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fabs %0,%1" - [(set_attr "type" "fp")]) - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fnabs %0,%1" - [(set_attr "type" "fp")]) - -(define_expand "addsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (plus:SF (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" - "") - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f") - (match_operand:SF 2 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fadds %0,%1,%2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_s")]) - -(define_expand "subsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (minus:SF (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" - "") - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fsubs %0,%1,%2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_s")]) - -(define_expand "mulsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (mult:SF (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT" - "") - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f") - (match_operand:SF 2 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fmuls %0,%1,%2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_mul_s")]) - -(define_expand "divsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (div:SF (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" - "") - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (div:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS - && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" - "fdivs %0,%1,%2" - [(set_attr "type" "sdiv")]) - -(define_insn "fres" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))] - "TARGET_FRES" - "fres %0,%1" - [(set_attr "type" "fp")]) - -; builtin fmaf support -(define_insn "*fmasf4_fpr" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f") - (match_operand:SF 3 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fmadds %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_s")]) - -(define_insn "*fmssf4_fpr" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f") - (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fmsubs %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_s")]) - -(define_insn "*nfmasf4_fpr" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f") - (match_operand:SF 3 "gpc_reg_operand" "f"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fnmadds %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_s")]) - -(define_insn "*nfmssf4_fpr" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f") - (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fnmsubs %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_s")]) - -(define_expand "sqrtsf2" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))] - "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) - && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT - && !TARGET_SIMPLE_FPU" - "") - -(define_insn "" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))] - "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT - && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU" - "fsqrts %0,%1" - [(set_attr "type" "ssqrt")]) - -(define_insn "*rsqrtsf_internal1" - [(set (match_operand:SF 0 "gpc_reg_operand" "=f") - (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] - UNSPEC_RSQRT))] - "TARGET_FRSQRTES" - "frsqrtes %0,%1" - [(set_attr "type" "fp")]) - ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in ;; builtins.c and optabs.c that are not correct for IBM long double ;; when little-endian. @@ -5010,37 +5022,82 @@ ;; Use an unspec rather providing an if-then-else in RTL, to prevent the ;; compiler from optimizing -0.0 (define_insn "copysign3_fcpsgn" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "") - (match_operand:SFDF 2 "gpc_reg_operand" "")] + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",") + (match_operand:SFDF 2 "gpc_reg_operand" ",")] UNSPEC_COPYSIGN))] - "TARGET_CMPB && !VECTOR_UNIT_VSX_P (mode)" - "fcpsgn %0,%2,%1" + "TARGET__FPR && TARGET_CMPB" + "@ + fcpsgn %0,%2,%1 + xscpsgn %x0,%x2,%x1" [(set_attr "type" "fp")]) ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a ;; fsel instruction and some auxiliary computations. Then we just have a ;; single DEFINE_INSN for fsel and the define_splits to make them if made by ;; combine. -(define_expand "smaxsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")) - (match_dup 1) - (match_dup 2)))] - "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS - && TARGET_SINGLE_FLOAT && !flag_trapping_math" - "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}") +;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we +;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary +;; computations. Then we just have a single DEFINE_INSN for fsel and the +;; define_splits to make them if made by combine. On VSX machines we have the +;; min/max instructions. +;; +;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector +;; to allow either DF/SF to use only traditional registers. -(define_expand "sminsf3" - [(set (match_operand:SF 0 "gpc_reg_operand" "") - (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "") - (match_operand:SF 2 "gpc_reg_operand" "")) - (match_dup 2) - (match_dup 1)))] - "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS - && TARGET_SINGLE_FLOAT && !flag_trapping_math" - "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}") +(define_expand "smax3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")) + (match_dup 1) + (match_dup 2)))] + "TARGET__FPR && TARGET_PPC_GFXOPT && !flag_trapping_math" +{ + rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); + DONE; +}) + +(define_insn "*smax3_vsx" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%,") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR && TARGET_VSX" + "xsmaxdp %x0,%x1,%x2" + [(set_attr "type" "fp")]) + +(define_expand "smin3" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")) + (match_dup 2) + (match_dup 1)))] + "TARGET__FPR && TARGET_PPC_GFXOPT && !flag_trapping_math" +{ + rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); + DONE; +}) + +(define_insn "*smin3_vsx" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%,") + (match_operand:SFDF 2 "gpc_reg_operand" ",")))] + "TARGET__FPR && TARGET_VSX" + "xsmindp %x0,%x1,%x2" + [(set_attr "type" "fp")]) + +(define_split + [(set (match_operand:SFDF 0 "gpc_reg_operand" "") + (match_operator:SFDF 3 "min_max_operator" + [(match_operand:SFDF 1 "gpc_reg_operand" "") + (match_operand:SFDF 2 "gpc_reg_operand" "")]))] + "TARGET__FPR && TARGET_PPC_GFXOPT && !flag_trapping_math + && !TARGET_VSX" + [(const_int 0)] +{ + rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1], + operands[2]); + DONE; +}) (define_split [(set (match_operand:SF 0 "gpc_reg_operand" "") @@ -5172,208 +5229,9 @@ "fsel %0,%1,%2,%3" [(set_attr "type" "fp")]) -(define_expand "negdf2" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" - "") - -(define_insn "*negdf2_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fneg %0,%1" - [(set_attr "type" "fp")]) - -(define_expand "absdf2" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" - "") - -(define_insn "*absdf2_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fabs %0,%1" - [(set_attr "type" "fp")]) - -(define_insn "*nabsdf2_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fnabs %0,%1" - [(set_attr "type" "fp")]) - -(define_expand "adddf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (plus:DF (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" - "") - -(define_insn "*adddf3_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d") - (match_operand:DF 2 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fadd %0,%1,%2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_d")]) - -(define_expand "subdf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (minus:DF (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" - "") - -(define_insn "*subdf3_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d") - (match_operand:DF 2 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fsub %0,%1,%2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_d")]) - -(define_expand "muldf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (mult:DF (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)" - "") - -(define_insn "*muldf3_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d") - (match_operand:DF 2 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fmul %0,%1,%2" - [(set_attr "type" "dmul") - (set_attr "fp_type" "fp_mul_d")]) - -(define_expand "divdf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (div:DF (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")))] - "TARGET_HARD_FLOAT - && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE) - && !TARGET_SIMPLE_FPU" - "") - -(define_insn "*divdf3_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (div:DF (match_operand:DF 1 "gpc_reg_operand" "d") - (match_operand:DF 2 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU - && !VECTOR_UNIT_VSX_P (DFmode)" - "fdiv %0,%1,%2" - [(set_attr "type" "ddiv")]) - -(define_insn "*fred_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=f") - (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))] - "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)" - "fre %0,%1" - [(set_attr "type" "fp")]) - -(define_insn "*rsqrtdf_internal1" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] - UNSPEC_RSQRT))] - "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)" - "frsqrte %0,%1" - [(set_attr "type" "fp")]) - -; builtin fma support -(define_insn "*fmadf4_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=f") - (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") - (match_operand:DF 2 "gpc_reg_operand" "f") - (match_operand:DF 3 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && VECTOR_UNIT_NONE_P (DFmode)" - "fmadd %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - -(define_insn "*fmsdf4_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=f") - (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") - (match_operand:DF 2 "gpc_reg_operand" "f") - (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && VECTOR_UNIT_NONE_P (DFmode)" - "fmsub %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - -(define_insn "*nfmadf4_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=f") - (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") - (match_operand:DF 2 "gpc_reg_operand" "f") - (match_operand:DF 3 "gpc_reg_operand" "f"))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && VECTOR_UNIT_NONE_P (DFmode)" - "fnmadd %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - -(define_insn "*nfmsdf4_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=f") - (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f") - (match_operand:DF 2 "gpc_reg_operand" "f") - (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && VECTOR_UNIT_NONE_P (DFmode)" - "fnmsub %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - -(define_expand "sqrtdf2" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))] - "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT" - "") - -(define_insn "*sqrtdf2_fpr" - [(set (match_operand:DF 0 "gpc_reg_operand" "=d") - (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))] - "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fsqrt %0,%1" - [(set_attr "type" "dsqrt")]) - ;; The conditional move instructions allow us to perform max and min ;; operations even when -(define_expand "smaxdf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")) - (match_dup 1) - (match_dup 2)))] - "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !flag_trapping_math" - "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}") - -(define_expand "smindf3" - [(set (match_operand:DF 0 "gpc_reg_operand" "") - (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "") - (match_operand:DF 2 "gpc_reg_operand" "")) - (match_dup 2) - (match_dup 1)))] - "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !flag_trapping_math" - "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}") - (define_split [(set (match_operand:DF 0 "gpc_reg_operand" "") (match_operator:DF 3 "min_max_operator" @@ -6057,66 +5915,52 @@ [(set (match_operand:DI 0 "gpc_reg_operand" "=d") (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "")] UNSPEC_FCTID))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && " + "TARGET__FPR && TARGET_FPRND" "fctid %0,%1" [(set_attr "type" "fp")]) -(define_expand "btrunc2" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] +(define_insn "btrunc2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",")] UNSPEC_FRIZ))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && " - "") - -(define_insn "*btrunc2_fpr" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] - UNSPEC_FRIZ))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && - && !VECTOR_UNIT_VSX_P (mode)" - "friz %0,%1" - [(set_attr "type" "fp")]) + "TARGET__FPR && TARGET_FPRND" + "@ + friz %0,%1 + xsrdpiz %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) -(define_expand "ceil2" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] +(define_insn "ceil2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",")] UNSPEC_FRIP))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && " - "") - -(define_insn "*ceil2_fpr" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] - UNSPEC_FRIP))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && - && !VECTOR_UNIT_VSX_P (mode)" - "frip %0,%1" - [(set_attr "type" "fp")]) - -(define_expand "floor2" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] - UNSPEC_FRIM))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && " - "") + "TARGET__FPR && TARGET_FPRND" + "@ + frip %0,%1 + xsrdpip %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) -(define_insn "*floor2_fpr" - [(set (match_operand:SFDF 0 "gpc_reg_operand" "=") - (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] +(define_insn "floor2" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,") + (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" ",")] UNSPEC_FRIM))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && - && !VECTOR_UNIT_VSX_P (mode)" - "frim %0,%1" - [(set_attr "type" "fp")]) + "TARGET__FPR && TARGET_FPRND" + "@ + frim %0,%1 + xsrdpim %x0,%x1" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) ;; No VSX equivalent to frin (define_insn "round2" [(set (match_operand:SFDF 0 "gpc_reg_operand" "=") (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")] UNSPEC_FRIN))] - "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && " + "TARGET__FPR && TARGET_FPRND" "frin %0,%1" - [(set_attr "type" "fp")]) + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_addsub_")]) ; An UNSPEC is used so we don't have to support SImode in FP registers. (define_insn "stfiwx" @@ -8748,8 +8592,8 @@ }") (define_insn "mov_hardfloat" - [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,,,wm,Z,?,?r,*c*l,!r,*h,!r,!r") - (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,,,Z,wm,r,,r,h,0,G,Fn"))] + [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,,,wu,Z,?,?r,*c*l,!r,*h,!r,!r") + (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,,,Z,wu,r,,r,h,0,G,Fn"))] "(gpc_reg_operand (operands[0], mode) || gpc_reg_operand (operands[1], mode)) && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)" @@ -8960,8 +8804,8 @@ ;; reloading. (define_insn "*mov_hardfloat32" - [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r") - (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))] + [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r") + (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))] "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && (gpc_reg_operand (operands[0], mode) || gpc_reg_operand (operands[1], mode))" @@ -8970,11 +8814,8 @@ lfd%U1%X1 %0,%1 fmr %0,%1 lxsd%U1x %x0,%y1 - lxsd%U1x %x0,%y1 - stxsd%U0x %x1,%y0 stxsd%U0x %x1,%y0 xxlor %x0,%x1,%x1 - xxlor %x0,%x1,%x1 xxlxor %x0,%x0,%x0 # # @@ -9002,28 +8843,19 @@ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") (const_string "fpload_ux") (const_string "fpload")) - (if_then_else - (match_test "update_indexed_address_mem (operands[1], VOIDmode)") - (const_string "fpload_ux") - (const_string "fpload")) - (if_then_else - (match_test "update_indexed_address_mem (operands[0], VOIDmode)") - (const_string "fpstore_ux") - (const_string "fpstore")) (if_then_else (match_test "update_indexed_address_mem (operands[0], VOIDmode)") (const_string "fpstore_ux") (const_string "fpstore")) (const_string "vecsimple") (const_string "vecsimple") - (const_string "vecsimple") (const_string "store") (const_string "load") (const_string "two") (const_string "fp") (const_string "fp") (const_string "*")]) - (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")]) + (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")]) (define_insn "*mov_softfloat32" [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r") @@ -9040,8 +8872,8 @@ ; ld/std require word-aligned displacements -> 'Y' constraint. ; List Y->r and r->Y before r->r for reload. (define_insn "*mov_hardfloat64" - [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm") - (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))] + [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm") + (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))] "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && (gpc_reg_operand (operands[0], mode) || gpc_reg_operand (operands[1], mode))" @@ -9050,10 +8882,7 @@ lfd%U1%X1 %0,%1 fmr %0,%1 lxsd%U1x %x0,%y1 - lxsd%U1x %x0,%y1 stxsd%U0x %x1,%y0 - stxsd%U0x %x1,%y0 - xxlor %x0,%x1,%x1 xxlor %x0,%x1,%x1 xxlxor %x0,%x0,%x0 std%U0%X0 %1,%0 @@ -9089,21 +8918,12 @@ (match_test "update_indexed_address_mem (operands[1], VOIDmode)") (const_string "fpload_ux") (const_string "fpload")) - (if_then_else - (match_test "update_indexed_address_mem (operands[1], VOIDmode)") - (const_string "fpload_ux") - (const_string "fpload")) - (if_then_else - (match_test "update_indexed_address_mem (operands[0], VOIDmode)") - (const_string "fpstore_ux") - (const_string "fpstore")) (if_then_else (match_test "update_indexed_address_mem (operands[0], VOIDmode)") (const_string "fpstore_ux") (const_string "fpstore")) (const_string "vecsimple") (const_string "vecsimple") - (const_string "vecsimple") (if_then_else (match_test "update_indexed_address_mem (operands[0], VOIDmode)") (const_string "store_ux") @@ -9129,7 +8949,7 @@ (const_string "mffgpr") (const_string "mftgpr") (const_string "mffgpr")]) - (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")]) + (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")]) (define_insn "*mov_softfloat64" [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h") @@ -9796,8 +9616,8 @@ { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }) (define_insn "*movdi_internal64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wa,?wa,r,*h,*h,?wa,r,?*wg,r,?*wm") - (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wa,Z,wa,*h,r,0,O,*wg,r,*wm,r"))] + [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wv,?wa,r,*h,*h,?wa,r,?*wg,r,?*wm") + (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wv,Z,wa,*h,r,0,O,*wg,r,*wm,r"))] "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode) || gpc_reg_operand (operands[1], DImode))" @@ -12822,23 +12642,6 @@ [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2))) (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))]) -(define_insn "*cmpsf_internal1" - [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") - (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f") - (match_operand:SF 2 "gpc_reg_operand" "f")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT" - "fcmpu %0,%1,%2" - [(set_attr "type" "fpcompare")]) - -(define_insn "*cmpdf_internal1" - [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") - (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d") - (match_operand:DF 2 "gpc_reg_operand" "d")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && !VECTOR_UNIT_VSX_P (DFmode)" - "fcmpu %0,%1,%2" - [(set_attr "type" "fpcompare")]) - ;; Only need to compare second words if first words equal (define_insn "*cmptf_internal1" [(set (match_operand:CCFP 0 "cc_reg_operand" "=y") @@ -15133,6 +14936,20 @@ "" "") +(define_insn "*fma4_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,,") + (fma:SFDF + (match_operand:SFDF 1 "gpc_reg_operand" "%,,") + (match_operand:SFDF 2 "gpc_reg_operand" ",,0") + (match_operand:SFDF 3 "gpc_reg_operand" ",0,")))] + "TARGET__FPR" + "@ + fmadd %0,%1,%2,%3 + xsmadda %x0,%x1,%x2 + xsmaddm %x0,%x1,%x3" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_maddsub_")]) + ; Altivec only has fma and nfms. (define_expand "fms4" [(set (match_operand:FMA_F 0 "register_operand" "") @@ -15143,6 +14960,20 @@ "!VECTOR_UNIT_ALTIVEC_P (mode)" "") +(define_insn "*fms4_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,,") + (fma:SFDF + (match_operand:SFDF 1 "gpc_reg_operand" ",,") + (match_operand:SFDF 2 "gpc_reg_operand" ",,0") + (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" ",0,"))))] + "TARGET__FPR" + "@ + fmsub %0,%1,%2,%3 + xsmsuba %x0,%x1,%x2 + xsmsubm %x0,%x1,%x3" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_maddsub_")]) + ;; If signed zeros are ignored, -(a * b - c) = -a * b + c. (define_expand "fnma4" [(set (match_operand:FMA_F 0 "register_operand" "") @@ -15176,6 +15007,21 @@ "!VECTOR_UNIT_ALTIVEC_P (mode)" "") +(define_insn "*nfma4_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,,") + (neg:SFDF + (fma:SFDF + (match_operand:SFDF 1 "gpc_reg_operand" ",,") + (match_operand:SFDF 2 "gpc_reg_operand" ",,0") + (match_operand:SFDF 3 "gpc_reg_operand" ",0,"))))] + "TARGET__FPR" + "@ + fnmadd %0,%1,%2,%3 + xsnmadda %x0,%x1,%x2 + xsnmaddm %x0,%x1,%x3" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_maddsub_")]) + ; Not an official optab name, but used from builtins. (define_expand "nfms4" [(set (match_operand:FMA_F 0 "register_operand" "") @@ -15187,6 +15033,23 @@ "" "") +(define_insn "*nfmssf4_fpr" + [(set (match_operand:SFDF 0 "gpc_reg_operand" "=,,") + (neg:SFDF + (fma:SFDF + (match_operand:SFDF 1 "gpc_reg_operand" ",,") + (match_operand:SFDF 2 "gpc_reg_operand" ",,0") + (neg:SFDF + (match_operand:SFDF 3 "gpc_reg_operand" ",0,")))))] + "TARGET__FPR" + "@ + fnmsub %0,%1,%2,%3 + xsnmsuba %x0,%x1,%x2 + xsnmsubm %x0,%x1,%x3" + [(set_attr "type" "fp") + (set_attr "fp_type" "fp_maddsub_")]) + + (define_expand "rs6000_get_timebase" [(use (match_operand:DI 0 "gpc_reg_operand" ""))] "" diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index f36e4758031..d988812a3a7 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -181,13 +181,16 @@ mvsx Target Report Mask(VSX) Var(rs6000_isa_flags) Use vector/scalar (VSX) instructions +mvsx-scalar-float +Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1) +; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default) + mvsx-scalar-double -Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(-1) -; If -mvsx, use VSX arithmetic instructions for scalar double (on by default) +Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(1) +; If -mvsx, use VSX arithmetic instructions for DFmode (on by default) mvsx-scalar-memory -Target Undocumented Report Var(TARGET_VSX_SCALAR_MEMORY) -; If -mvsx, use VSX scalar memory reference instructions for scalar double (off by default) +Target Undocumented Report Alias(mupper-regs-df) mvsx-align-128 Target Undocumented Report Var(TARGET_VSX_ALIGN_128) @@ -546,3 +549,11 @@ Use ISA 2.07 transactional memory (HTM) instructions mquad-memory Target Report Mask(QUAD_MEMORY) Var(rs6000_isa_flags) Generate the quad word memory instructions (lq/stq/lqarx/stqcx). + +mupper-regs-df +Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags) +Allow double variables in upper registers with -mcpu=power7 or -mvsx + +mupper-regs-sf +Target Undocumented Mask(UPPER_REGS_SF) Var(rs6000_isa_flags) +Allow float variables in upper registers with -mcpu=power8 or -mp8-vector diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 11d6b8bb4d0..988842f9fe8 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -316,40 +316,42 @@ "") -;; VSX scalar and vector floating point arithmetic instructions +;; VSX vector floating point arithmetic instructions. The VSX scalar +;; instructions are now combined with the insn for the traditional floating +;; point unit. (define_insn "*vsx_add3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (plus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xadd %x0,%x1,%x2" + "xvadd %x0,%x1,%x2" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_sub3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (minus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xsub %x0,%x1,%x2" + "xvsub %x0,%x1,%x2" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_mul3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (mult:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xmul %x0,%x1,%x2" - [(set_attr "type" "") + "xvmul %x0,%x1,%x2" + [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_div3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (div:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xdiv %x0,%x1,%x2" + "xvdiv %x0,%x1,%x2" [(set_attr "type" "") (set_attr "fp_type" "")]) @@ -392,94 +394,72 @@ (set_attr "fp_type" "")]) (define_insn "vsx_fre2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] UNSPEC_FRES))] "VECTOR_UNIT_VSX_P (mode)" - "xre %x0,%x1" + "xvre %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_neg2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (neg:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xneg %x0,%x1" + "xvneg %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_abs2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xabs %x0,%x1" + "xvabs %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "vsx_nabs2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (neg:VSX_B - (abs:VSX_B - (match_operand:VSX_B 1 "vsx_register_operand" ",wa"))))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (neg:VSX_F + (abs:VSX_F + (match_operand:VSX_F 1 "vsx_register_operand" ",wa"))))] "VECTOR_UNIT_VSX_P (mode)" - "xnabs %x0,%x1" + "xvnabs %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "vsx_smax3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (smax:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xmax %x0,%x1,%x2" + "xvmax %x0,%x1,%x2" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_smin3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (smin:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xmin %x0,%x1,%x2" + "xvmin %x0,%x1,%x2" [(set_attr "type" "") (set_attr "fp_type" "")]) -;; Special VSX version of smin/smax for single precision floating point. Since -;; both numbers are rounded to single precision, we can just use the DP version -;; of the instruction. - -(define_insn "*vsx_smaxsf3" - [(set (match_operand:SF 0 "vsx_register_operand" "=f") - (smax:SF (match_operand:SF 1 "vsx_register_operand" "f") - (match_operand:SF 2 "vsx_register_operand" "f")))] - "VECTOR_UNIT_VSX_P (DFmode)" - "xsmaxdp %x0,%x1,%x2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_d")]) - -(define_insn "*vsx_sminsf3" - [(set (match_operand:SF 0 "vsx_register_operand" "=f") - (smin:SF (match_operand:SF 1 "vsx_register_operand" "f") - (match_operand:SF 2 "vsx_register_operand" "f")))] - "VECTOR_UNIT_VSX_P (DFmode)" - "xsmindp %x0,%x1,%x2" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_addsub_d")]) - (define_insn "*vsx_sqrt2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (sqrt:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xsqrt %x0,%x1" + "xvsqrt %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "*vsx_rsqrte2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] UNSPEC_RSQRT))] "VECTOR_UNIT_VSX_P (mode)" - "xrsqrte %x0,%x1" + "xvrsqrte %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) @@ -518,26 +498,10 @@ [(set_attr "type" "") (set_attr "fp_type" "")]) -;; Fused vector multiply/add instructions Support the classical DF versions of -;; fma, which allows the target to be a separate register from the 3 inputs. -;; Under VSX, the target must be either the addend or the first multiply. -;; Where we can, also do the same for the Altivec V4SF fmas. - -(define_insn "*vsx_fmadf4" - [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") - (fma:DF - (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") - (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") - (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))] - "VECTOR_UNIT_VSX_P (DFmode)" - "@ - xsmaddadp %x0,%x1,%x2 - xsmaddmdp %x0,%x1,%x3 - xsmaddadp %x0,%x1,%x2 - xsmaddmdp %x0,%x1,%x3 - fmadd %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) +;; Fused vector multiply/add instructions. Support the classical Altivec +;; versions of fma, which allows the target to be a separate register from the +;; 3 inputs. Under VSX, the target must be either the addend or the first +;; multiply. (define_insn "*vsx_fmav4sf4" [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v") @@ -568,23 +532,6 @@ xvmaddmdp %x0,%x1,%x3" [(set_attr "type" "vecdouble")]) -(define_insn "*vsx_fmsdf4" - [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") - (fma:DF - (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") - (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") - (neg:DF - (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))] - "VECTOR_UNIT_VSX_P (DFmode)" - "@ - xsmsubadp %x0,%x1,%x2 - xsmsubmdp %x0,%x1,%x3 - xsmsubadp %x0,%x1,%x2 - xsmsubmdp %x0,%x1,%x3 - fmsub %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - (define_insn "*vsx_fms4" [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?wa,?wa") (fma:VSX_F @@ -594,29 +541,12 @@ (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,wa"))))] "VECTOR_UNIT_VSX_P (mode)" "@ - xmsuba %x0,%x1,%x2 - xmsubm %x0,%x1,%x3 - xmsuba %x0,%x1,%x2 - xmsubm %x0,%x1,%x3" + xvmsuba %x0,%x1,%x2 + xvmsubm %x0,%x1,%x3 + xvmsuba %x0,%x1,%x2 + xvmsubm %x0,%x1,%x3" [(set_attr "type" "")]) -(define_insn "*vsx_nfmadf4" - [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") - (neg:DF - (fma:DF - (match_operand:DF 1 "vsx_register_operand" "ws,ws,wa,wa,d") - (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") - (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))] - "VECTOR_UNIT_VSX_P (DFmode)" - "@ - xsnmaddadp %x0,%x1,%x2 - xsnmaddmdp %x0,%x1,%x3 - xsnmaddadp %x0,%x1,%x2 - xsnmaddmdp %x0,%x1,%x3 - fnmadd %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - (define_insn "*vsx_nfma4" [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,,?wa,?wa") (neg:VSX_F @@ -626,31 +556,13 @@ (match_operand:VSX_F 3 "vsx_register_operand" "0,,0,wa"))))] "VECTOR_UNIT_VSX_P (mode)" "@ - xnmadda %x0,%x1,%x2 - xnmaddm %x0,%x1,%x3 - xnmadda %x0,%x1,%x2 - xnmaddm %x0,%x1,%x3" + xvnmadda %x0,%x1,%x2 + xvnmaddm %x0,%x1,%x3 + xvnmadda %x0,%x1,%x2 + xvnmaddm %x0,%x1,%x3" [(set_attr "type" "") (set_attr "fp_type" "")]) -(define_insn "*vsx_nfmsdf4" - [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d") - (neg:DF - (fma:DF - (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d") - (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d") - (neg:DF - (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))))] - "VECTOR_UNIT_VSX_P (DFmode)" - "@ - xsnmsubadp %x0,%x1,%x2 - xsnmsubmdp %x0,%x1,%x3 - xsnmsubadp %x0,%x1,%x2 - xsnmsubmdp %x0,%x1,%x3 - fnmsub %0,%1,%2,%3" - [(set_attr "type" "fp") - (set_attr "fp_type" "fp_maddsub_d")]) - (define_insn "*vsx_nfmsv4sf4" [(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v") (neg:V4SF @@ -712,16 +624,6 @@ [(set_attr "type" "") (set_attr "fp_type" "")]) -;; Floating point scalar compare -(define_insn "*vsx_cmpdf_internal1" - [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,?y") - (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "ws,wa") - (match_operand:DF 2 "gpc_reg_operand" "ws,wa")))] - "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT - && VECTOR_UNIT_VSX_P (DFmode)" - "xscmpudp %0,%x1,%x2" - [(set_attr "type" "fpcompare")]) - ;; Compare vectors producing a vector result and a predicate, setting CR6 to ;; indicate a combined status (define_insn "*vsx_eq__p" @@ -788,13 +690,13 @@ ;; Copy sign (define_insn "vsx_copysign3" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (unspec:VSX_B - [(match_operand:VSX_B 1 "vsx_register_operand" ",wa") - (match_operand:VSX_B 2 "vsx_register_operand" ",wa")] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (unspec:VSX_F + [(match_operand:VSX_F 1 "vsx_register_operand" ",wa") + (match_operand:VSX_F 2 "vsx_register_operand" ",wa")] UNSPEC_COPYSIGN))] "VECTOR_UNIT_VSX_P (mode)" - "xcpsgn %x0,%x2,%x1" + "xvcpsgn %x0,%x2,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) @@ -855,10 +757,10 @@ (set_attr "fp_type" "")]) (define_insn "vsx_btrunc2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (fix:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" ",wa")))] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" ",wa")))] "VECTOR_UNIT_VSX_P (mode)" - "xriz %x0,%x1" + "xvriz %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) @@ -872,20 +774,20 @@ (set_attr "fp_type" "")]) (define_insn "vsx_floor2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] UNSPEC_FRIM))] "VECTOR_UNIT_VSX_P (mode)" - "xrim %x0,%x1" + "xvrim %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) (define_insn "vsx_ceil2" - [(set (match_operand:VSX_B 0 "vsx_register_operand" "=,?wa") - (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" ",wa")] + [(set (match_operand:VSX_F 0 "vsx_register_operand" "=,?wa") + (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" ",wa")] UNSPEC_FRIP))] "VECTOR_UNIT_VSX_P (mode)" - "xrip %x0,%x1" + "xvrip %x0,%x1" [(set_attr "type" "") (set_attr "fp_type" "")]) diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index ed624d6e4ea..dacb83a7009 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -2070,40 +2070,52 @@ Floating point register (containing 32-bit value) Altivec vector register @item wa -Any VSX register +Any VSX register if the -mvsx option was used or NO_REGS. @item wd -VSX vector register to hold vector double data +VSX vector register to hold vector double data or NO_REGS. @item wf -VSX vector register to hold vector float data +VSX vector register to hold vector float data or NO_REGS. @item wg -If @option{-mmfpgpr} was used, a floating point register +If @option{-mmfpgpr} was used, a floating point register or NO_REGS. @item wl -If the LFIWAX instruction is enabled, a floating point register +Floating point register if the LFIWAX instruction is enabled or NO_REGS. @item wm -If direct moves are enabled, a VSX register. +VSX register if direct move instructions are enabled, or NO_REGS. @item wn -No register. +No register (NO_REGS). @item wr -General purpose register if 64-bit mode is used +General purpose register if 64-bit instructions are enabled or NO_REGS. @item ws -VSX vector register to hold scalar float data +VSX vector register to hold scalar double values or NO_REGS. @item wt -VSX vector register to hold 128 bit integer +VSX vector register to hold 128 bit integer or NO_REGS. + +@item wu +Altivec register to use for float/32-bit int loads/stores or NO_REGS. + +@item wv +Altivec register to use for double loads/stores or NO_REGS. + +@item ww +FP or VSX register to perform float operations under @option{-mvsx} or NO_REGS. @item wx -If the STFIWX instruction is enabled, a floating point register +Floating point register if the STFIWX instruction is enabled or NO_REGS. + +@item wy +VSX vector register to hold scalar float values or NO_REGS. @item wz -If the LFIWZX instruction is enabled, a floating point register +Floating point register if the LFIWZX instruction is enabled or NO_REGS. @item wQ A memory address that will work with the @code{lq} and @code{stq} diff --git a/gcc/testsuite/ChangeLog.ibm b/gcc/testsuite/ChangeLog.ibm index 7379416560f..891d477626f 100644 --- a/gcc/testsuite/ChangeLog.ibm +++ b/gcc/testsuite/ChangeLog.ibm @@ -1,5 +1,25 @@ 2013-10-17 Michael Meissner + Back port from mainline + 2013-10-03 Michael Meissner + + * gcc.target/powerpc/p8vector-fp.c: New test for floating point + scalar operations when using -mupper-regs-sf and -mupper-regs-df. + * gcc.target/powerpc/ppc-target-1.c: Update tests to allow either + VSX scalar operations or the traditional floating point form of + the instruction. + * gcc.target/powerpc/ppc-target-2.c: Likewise. + * gcc.target/powerpc/recip-3.c: Likewise. + * gcc.target/powerpc/recip-5.c: Likewise. + * gcc.target/powerpc/pr72747.c: Likewise. + * gcc.target/powerpc/vsx-builtin-3.c: Likewise. + + Back port from mainline + 2013-09-27 Michael Meissner + + * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf + and -mupper-regs-df. + Back port from mainline 2013-10-17 Michael Meissner diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c b/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c new file mode 100644 index 00000000000..3cfd8161dd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c @@ -0,0 +1,139 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf -fno-math-errno" } */ + +float abs_sf (float *p) +{ + float f = *p; + __asm__ ("# reg %x0" : "+v" (f)); + return __builtin_fabsf (f); +} + +float nabs_sf (float *p) +{ + float f = *p; + __asm__ ("# reg %x0" : "+v" (f)); + return - __builtin_fabsf (f); +} + +float neg_sf (float *p) +{ + float f = *p; + __asm__ ("# reg %x0" : "+v" (f)); + return - f; +} + +float add_sf (float *p, float *q) +{ + float f1 = *p; + float f2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); + return f1 + f2; +} + +float sub_sf (float *p, float *q) +{ + float f1 = *p; + float f2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); + return f1 - f2; +} + +float mul_sf (float *p, float *q) +{ + float f1 = *p; + float f2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); + return f1 * f2; +} + +float div_sf (float *p, float *q) +{ + float f1 = *p; + float f2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2)); + return f1 / f2; +} + +float sqrt_sf (float *p) +{ + float f = *p; + __asm__ ("# reg %x0" : "+v" (f)); + return __builtin_sqrtf (f); +} + + +double abs_df (double *p) +{ + double d = *p; + __asm__ ("# reg %x0" : "+v" (d)); + return __builtin_fabs (d); +} + +double nabs_df (double *p) +{ + double d = *p; + __asm__ ("# reg %x0" : "+v" (d)); + return - __builtin_fabs (d); +} + +double neg_df (double *p) +{ + double d = *p; + __asm__ ("# reg %x0" : "+v" (d)); + return - d; +} + +double add_df (double *p, double *q) +{ + double d1 = *p; + double d2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); + return d1 + d2; +} + +double sub_df (double *p, double *q) +{ + double d1 = *p; + double d2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); + return d1 - d2; +} + +double mul_df (double *p, double *q) +{ + double d1 = *p; + double d2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); + return d1 * d2; +} + +double div_df (double *p, double *q) +{ + double d1 = *p; + double d2 = *q; + __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2)); + return d1 / d2; +} + +double sqrt_df (float *p) +{ + double d = *p; + __asm__ ("# reg %x0" : "+v" (d)); + return __builtin_sqrt (d); +} + +/* { dg-final { scan-assembler "xsabsdp" } } */ +/* { dg-final { scan-assembler "xsadddp" } } */ +/* { dg-final { scan-assembler "xsaddsp" } } */ +/* { dg-final { scan-assembler "xsdivdp" } } */ +/* { dg-final { scan-assembler "xsdivsp" } } */ +/* { dg-final { scan-assembler "xsmuldp" } } */ +/* { dg-final { scan-assembler "xsmulsp" } } */ +/* { dg-final { scan-assembler "xsnabsdp" } } */ +/* { dg-final { scan-assembler "xsnegdp" } } */ +/* { dg-final { scan-assembler "xssqrtdp" } } */ +/* { dg-final { scan-assembler "xssqrtsp" } } */ +/* { dg-final { scan-assembler "xssubdp" } } */ +/* { dg-final { scan-assembler "xssubsp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c new file mode 100644 index 00000000000..d0b3eb09ef7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c @@ -0,0 +1,42 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */ + +float load_sf (float *p) +{ + float f = *p; + __asm__ ("# reg %x0" : "+v" (f)); + return f; +} + +double load_df (double *p) +{ + double d = *p; + __asm__ ("# reg %x0" : "+v" (d)); + return d; +} + +double load_dfsf (float *p) +{ + double d = (double) *p; + __asm__ ("# reg %x0" : "+v" (d)); + return d; +} + +void store_sf (float *p, float f) +{ + __asm__ ("# reg %x0" : "+v" (f)); + *p = f; +} + +void store_df (double *p, double d) +{ + __asm__ ("# reg %x0" : "+v" (d)); + *p = d; +} + +/* { dg-final { scan-assembler-times "lxsspx" 2 } } */ +/* { dg-final { scan-assembler-times "lxsdx" 1 } } */ +/* { dg-final { scan-assembler-times "stxsspx" 1 } } */ +/* { dg-final { scan-assembler-times "stxsdx" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c index c98666c47a0..b39fe4115bc 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c @@ -5,8 +5,7 @@ /* { dg-final { scan-assembler-times "fabs" 3 } } */ /* { dg-final { scan-assembler-times "fnabs" 3 } } */ /* { dg-final { scan-assembler-times "fsel" 3 } } */ -/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */ -/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */ +/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */ double normal1 (double, double); double power5 (double, double) __attribute__((__target__("cpu=power5"))); diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c b/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c index 8ef95b7a15b..e8a2de3636a 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c @@ -5,8 +5,7 @@ /* { dg-final { scan-assembler-times "fabs" 3 } } */ /* { dg-final { scan-assembler-times "fnabs" 3 } } */ /* { dg-final { scan-assembler-times "fsel" 3 } } */ -/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */ -/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */ +/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */ /* fabs/fnabs/fsel */ double normal1 (double a, double b) { return __builtin_copysign (a, b); } diff --git a/gcc/testsuite/gcc.target/powerpc/pr42747.c b/gcc/testsuite/gcc.target/powerpc/pr42747.c index 9e7310e1767..41362db1774 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr42747.c +++ b/gcc/testsuite/gcc.target/powerpc/pr42747.c @@ -5,4 +5,4 @@ double foo (double x) { return __builtin_sqrt (x); } -/* { dg-final { scan-assembler "xssqrtdp" } } */ +/* { dg-final { scan-assembler "xssqrtdp\|fsqrt" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/recip-3.c b/gcc/testsuite/gcc.target/powerpc/recip-3.c index 905e793952e..238f8f36198 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-3.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-3.c @@ -1,14 +1,14 @@ /* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */ /* { dg-require-effective-target powerpc_fprs } */ /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power7" } */ -/* { dg-final { scan-assembler-times "xsrsqrtedp" 1 } } */ +/* { dg-final { scan-assembler-times "xsrsqrtedp\|frsqrte\ " 1 } } */ /* { dg-final { scan-assembler-times "xsmsub.dp\|fmsub\ " 1 } } */ -/* { dg-final { scan-assembler-times "xsmuldp" 4 } } */ +/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 4 } } */ /* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 2 } } */ -/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */ -/* { dg-final { scan-assembler-times "fmsubs" 1 } } */ -/* { dg-final { scan-assembler-times "fmuls" 4 } } */ -/* { dg-final { scan-assembler-times "fnmsubs" 2 } } */ +/* { dg-final { scan-assembler-times "xsrsqrtesp\|frsqrtes" 1 } } */ +/* { dg-final { scan-assembler-times "xsmsub.sp\|fmsubs" 1 } } */ +/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 4 } } */ +/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */ double rsqrt_d (double a) diff --git a/gcc/testsuite/gcc.target/powerpc/recip-5.c b/gcc/testsuite/gcc.target/powerpc/recip-5.c index 3d7d691d5ac..902fb2674b3 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-5.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-5.c @@ -4,8 +4,8 @@ /* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */ /* { dg-final { scan-assembler-times "xvredp" 4 } } */ /* { dg-final { scan-assembler-times "xvresp" 5 } } */ -/* { dg-final { scan-assembler-times "xsredp" 2 } } */ -/* { dg-final { scan-assembler-times "fres" 2 } } */ +/* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */ +/* { dg-final { scan-assembler-times "xsresp\|fres" 2 } } */ #include diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c index 8450920ec0c..7aeba6cb563 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c @@ -16,9 +16,9 @@ /* { dg-final { scan-assembler "xvrspiz" } } */ /* { dg-final { scan-assembler "xsrdpi" } } */ /* { dg-final { scan-assembler "xsrdpic" } } */ -/* { dg-final { scan-assembler "xsrdpim" } } */ -/* { dg-final { scan-assembler "xsrdpip" } } */ -/* { dg-final { scan-assembler "xsrdpiz" } } */ +/* { dg-final { scan-assembler "xsrdpim\|frim" } } */ +/* { dg-final { scan-assembler "xsrdpip\|frip" } } */ +/* { dg-final { scan-assembler "xsrdpiz\|friz" } } */ /* { dg-final { scan-assembler "xsmaxdp" } } */ /* { dg-final { scan-assembler "xsmindp" } } */ /* { dg-final { scan-assembler "xxland" } } */ -- cgit v1.2.3 From 271ba9bf902f018053c9563af602186f9ad5950a Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 18 Oct 2013 00:16:44 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203806 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 72d946af181..028287a89ff 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131017 +20131018 -- cgit v1.2.3 From 9221b33509441f9322d212ed0855d8582f44adb1 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 18 Oct 2013 13:26:14 +0000 Subject: runtime: Fix typo in dup3 fallback implementation. From Uros Bizjak. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203819 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-nosys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgo/runtime/go-nosys.c b/libgo/runtime/go-nosys.c index f389dbe0cbe..0a94de0523e 100644 --- a/libgo/runtime/go-nosys.c +++ b/libgo/runtime/go-nosys.c @@ -47,7 +47,7 @@ accept4 (int sockfd __attribute__ ((unused)), int dup3 (int oldfd __attribute__ ((unused)), int newfd __attribute__ ((unused)), - int flags __attribtue__ ((unused))) + int flags __attribute__ ((unused))) { errno = ENOSYS; return -1; -- cgit v1.2.3 From e526debee91c7055d1382398a72b9b39747c0c55 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 19 Oct 2013 00:16:32 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203838 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 028287a89ff..fa5d5121d10 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131018 +20131019 -- cgit v1.2.3 From 81acbf98bac88d668fa55639b16e06f0db1df5c2 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 19 Oct 2013 10:56:31 +0000 Subject: * gcc-interface/utils.c (gnat_set_type_context): New function. (gnat_pushdecl): Use it to set the context of the type. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203849 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/utils.c | 22 +++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8f647a70864..5298ba804a9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2013-10-19 Eric Botcazou + + * gcc-interface/utils.c (gnat_set_type_context): New function. + (gnat_pushdecl): Use it to set the context of the type. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index c5cee7a0098..9ee5766c65f 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -532,6 +532,22 @@ gnat_zaplevel (void) free_binding_level = level; } +/* Set the context of TYPE and its parallel types (if any) to CONTEXT. */ + +static void +gnat_set_type_context (tree type, tree context) +{ + tree decl = TYPE_STUB_DECL (type); + + TYPE_CONTEXT (type) = context; + + while (decl && DECL_PARALLEL_TYPE (decl)) + { + TYPE_CONTEXT (DECL_PARALLEL_TYPE (decl)) = context; + decl = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (decl)); + } +} + /* Record DECL as belonging to the current lexical scope and use GNAT_NODE for location information and flag propagation. */ @@ -613,7 +629,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) if (TREE_CODE (t) == POINTER_TYPE) TYPE_NEXT_PTR_TO (t) = tt; TYPE_NAME (tt) = DECL_NAME (decl); - TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); + gnat_set_type_context (tt, DECL_CONTEXT (decl)); TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); DECL_ORIGINAL_TYPE (decl) = tt; } @@ -623,7 +639,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) /* We need a variant for the placeholder machinery to work. */ tree tt = build_variant_type_copy (t); TYPE_NAME (tt) = decl; - TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); + gnat_set_type_context (tt, DECL_CONTEXT (decl)); TREE_USED (tt) = TREE_USED (t); TREE_TYPE (decl) = tt; if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) @@ -645,7 +661,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) { TYPE_NAME (t) = decl; - TYPE_CONTEXT (t) = DECL_CONTEXT (decl); + gnat_set_type_context (t, DECL_CONTEXT (decl)); } } } -- cgit v1.2.3 From ffb617a761f7d124dec51722ea0b38ecfb655f94 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 19 Oct 2013 11:11:47 +0000 Subject: * gcc-interface/utils.c (scale_by_factor_of): New function. (rest_of_record_type_compilation): Use scale_by_factor_of in order to scale the original offset for both rounding cases; in the second case, take into accout the addend to compute the alignment. Tidy up. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203853 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 7 +++ gcc/ada/gcc-interface/utils.c | 120 ++++++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 56 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5298ba804a9..24479a3fb6f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2013-10-19 Eric Botcazou + + * gcc-interface/utils.c (scale_by_factor_of): New function. + (rest_of_record_type_compilation): Use scale_by_factor_of in order to + scale the original offset for both rounding cases; in the second case, + take into accout the addend to compute the alignment. Tidy up. + 2013-10-19 Eric Botcazou * gcc-interface/utils.c (gnat_set_type_context): New function. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 9ee5766c65f..ec252829c63 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -232,6 +232,7 @@ static tree compute_related_constant (tree, tree); static tree split_plus (tree, tree *); static tree float_type_for_precision (int, enum machine_mode); static tree convert_to_fat_pointer (tree, tree); +static unsigned int scale_by_factor_of (tree, unsigned int); static bool potential_alignment_gap (tree, tree, tree); static void process_attributes (tree, struct attrib *); @@ -1708,93 +1709,74 @@ rest_of_record_type_compilation (tree record_type) TYPE_SIZE_UNIT (new_record_type) = size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT); - /* Now scan all the fields, replacing each field with a new - field corresponding to the new encoding. */ + /* Now scan all the fields, replacing each field with a new field + corresponding to the new encoding. */ for (old_field = TYPE_FIELDS (record_type); old_field; old_field = DECL_CHAIN (old_field)) { tree field_type = TREE_TYPE (old_field); tree field_name = DECL_NAME (old_field); - tree new_field; tree curpos = bit_position (old_field); + tree pos, new_field; bool var = false; unsigned int align = 0; - tree pos; - /* See how the position was modified from the last position. - - There are two basic cases we support: a value was added - to the last position or the last position was rounded to - a boundary and they something was added. Check for the - first case first. If not, see if there is any evidence - of rounding. If so, round the last position and try - again. + /* We're going to do some pattern matching below so remove as many + conversions as possible. */ + curpos = remove_conversions (curpos, true); - If this is a union, the position can be taken as zero. */ + /* See how the position was modified from the last position. - /* Some computations depend on the shape of the position expression, - so strip conversions to make sure it's exposed. */ - curpos = remove_conversions (curpos, true); + There are two basic cases we support: a value was added + to the last position or the last position was rounded to + a boundary and they something was added. Check for the + first case first. If not, see if there is any evidence + of rounding. If so, round the last position and retry. + If this is a union, the position can be taken as zero. */ if (TREE_CODE (new_record_type) == UNION_TYPE) - pos = bitsize_zero_node, align = 0; + pos = bitsize_zero_node; else pos = compute_related_constant (curpos, last_pos); - if (!pos && TREE_CODE (curpos) == MULT_EXPR + if (!pos + && TREE_CODE (curpos) == MULT_EXPR && host_integerp (TREE_OPERAND (curpos, 1), 1)) { tree offset = TREE_OPERAND (curpos, 0); align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); - - /* An offset which is a bitwise AND with a mask increases the - alignment according to the number of trailing zeros. */ - offset = remove_conversions (offset, true); - if (TREE_CODE (offset) == BIT_AND_EXPR - && TREE_CODE (TREE_OPERAND (offset, 1)) == INTEGER_CST) - { - unsigned HOST_WIDE_INT mask - = TREE_INT_CST_LOW (TREE_OPERAND (offset, 1)); - unsigned int i; - - for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++) - { - if (mask & 1) - break; - mask >>= 1; - align *= 2; - } - } - - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + align = scale_by_factor_of (offset, align); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } - else if (!pos && TREE_CODE (curpos) == PLUS_EXPR - && TREE_CODE (TREE_OPERAND (curpos, 1)) == INTEGER_CST + else if (!pos + && TREE_CODE (curpos) == PLUS_EXPR + && host_integerp (TREE_OPERAND (curpos, 1), 1) && TREE_CODE (TREE_OPERAND (curpos, 0)) == MULT_EXPR - && host_integerp (TREE_OPERAND - (TREE_OPERAND (curpos, 0), 1), - 1)) + && host_integerp + (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1)) { + tree offset = TREE_OPERAND (TREE_OPERAND (curpos, 0), 0); + unsigned HOST_WIDE_INT addend + = tree_low_cst (TREE_OPERAND (curpos, 1), 1); align - = tree_low_cst - (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + = tree_low_cst (TREE_OPERAND (TREE_OPERAND (curpos, 0), 1), 1); + align = scale_by_factor_of (offset, align); + align = MIN (align, addend & -addend); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } - else if (potential_alignment_gap (prev_old_field, old_field, - pos)) + else if (potential_alignment_gap (prev_old_field, old_field, pos)) { align = TYPE_ALIGN (field_type); - pos = compute_related_constant (curpos, - round_up (last_pos, align)); + last_pos = round_up (last_pos, align); + pos = compute_related_constant (curpos, last_pos); } /* If we can't compute a position, set it to zero. - ??? We really should abort here, but it's too much work - to get this correct for all cases. */ - + ??? We really should abort here, but it's too much work + to get this correct for all cases. */ if (!pos) pos = bitsize_zero_node; @@ -2569,6 +2551,32 @@ value_factor_p (tree value, HOST_WIDE_INT factor) return false; } +/* Return VALUE scaled by the biggest power-of-2 factor of EXPR. */ + +static unsigned int +scale_by_factor_of (tree expr, unsigned int value) +{ + expr = remove_conversions (expr, true); + + /* An expression which is a bitwise AND with a mask has a power-of-2 factor + corresponding to the number of trailing zeros of the mask. */ + if (TREE_CODE (expr) == BIT_AND_EXPR + && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST) + { + unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (TREE_OPERAND (expr, 1)); + unsigned int i = 0; + + while ((mask & 1) == 0 && i < HOST_BITS_PER_WIDE_INT) + { + mask >>= 1; + value *= 2; + i++; + } + } + + return value; +} + /* Given two consecutive field decls PREV_FIELD and CURR_FIELD, return true unless we can prove these 2 fields are laid out in such a way that no gap exist between the end of PREV_FIELD and the beginning of CURR_FIELD. OFFSET -- cgit v1.2.3 From c9761e27c4dcf50f41d12dd47c58f13659f0904b Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Sat, 19 Oct 2013 13:27:49 +0000 Subject: * gcc.target/sh/pr54089-3.c: Fix test for load of constant 31. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203858 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/sh/pr54089-3.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3740c532739..48c8bc2b3fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-19 Oleg Endo + + * gcc.target/sh/pr54089-3.c: Fix test for load of constant 31. + 2013-10-17 Paolo Carlini PR c++/58596 diff --git a/gcc/testsuite/gcc.target/sh/pr54089-3.c b/gcc/testsuite/gcc.target/sh/pr54089-3.c index ffb976ba11b..3fb0f7a9aea 100644 --- a/gcc/testsuite/gcc.target/sh/pr54089-3.c +++ b/gcc/testsuite/gcc.target/sh/pr54089-3.c @@ -5,7 +5,7 @@ /* { dg-options "-O1" } */ /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m1*" "-m2" "-m2e*" } } */ /* { dg-final { scan-assembler-not "and" } } */ -/* { dg-final { scan-assembler-not "31" } } */ +/* { dg-final { scan-assembler-not "#31" } } */ int test00 (unsigned int a, int* b, int c, int* d, unsigned int e) -- cgit v1.2.3 From 96a0bd72e40f1261698e53705bc77ac7d5bb01fa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 20 Oct 2013 00:16:34 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203868 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fa5d5121d10..ab8590227a9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131019 +20131020 -- cgit v1.2.3 From d0c0686a6101401fc671af4ec9cbbdb6af681d62 Mon Sep 17 00:00:00 2001 From: Chris Jefferson Date: Sun, 20 Oct 2013 09:08:12 +0000 Subject: 2013-10-20 Chris Jefferson Paolo Carlini PR libstdc++/58800 * include/bits/stl_algo.h (__unguarded_partition_pivot): Change __last - 2 to __last - 1. * testsuite/25_algorithms/nth_element/58800.cc: New git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203873 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++ libstdc++-v3/include/bits/stl_algo.h | 4 +- .../testsuite/25_algorithms/nth_element/58800.cc | 52 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c024336cc0d..1dcf11522f9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-10-20 Chris Jefferson + Paolo Carlini + + PR libstdc++/58800 + * include/bits/stl_algo.h (__unguarded_partition_pivot): Change + __last - 2 to __last - 1. + * testsuite/25_algorithms/nth_element/58800.cc: New + 2013-10-16 François Dumont PR libstdc++/58191 diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 35b5fa6fb50..7fa7133aeee 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -2279,7 +2279,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RandomAccessIterator __last) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2)); + std::__move_median_to_first(__first, __first + 1, __mid, __last - 1); return std::__unguarded_partition(__first + 1, __last, *__first); } @@ -2291,7 +2291,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RandomAccessIterator __last, _Compare __comp) { _RandomAccessIterator __mid = __first + (__last - __first) / 2; - std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2), + std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, __comp); return std::__unguarded_partition(__first + 1, __last, *__first, __comp); } diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc new file mode 100644 index 00000000000..108c0e5abd1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc @@ -0,0 +1,52 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 25.3.2 [lib.alg.nth.element] + +// { dg-options "-std=gnu++11" } + +#include +#include +#include + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; + +typedef test_container Container; + +void test01() +{ + std::vector v = { + 207089, + 202585, + 180067, + 157549, + 211592, + 216096, + 207089 + }; + + Container con(v.data(), v.data() + 7); + + std::nth_element(con.begin(), con.begin() + 3, con.end()); +} + +int main() +{ + test01(); + return 0; +} -- cgit v1.2.3 From 693e7e2a947bec88599d28e7230d964db28f11b7 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 21 Oct 2013 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203883 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ab8590227a9..afcbcf061d6 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131020 +20131021 -- cgit v1.2.3 From f22232640aaa1b0cedcffb956c6629207f47a274 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Mon, 21 Oct 2013 10:38:03 +0000 Subject: Backport: 2013-10-21 Mike Stump * gcc_update (configure): Update to handle svn 1.8.1. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203887 138bc75d-0d04-0410-961f-82ee72b054a4 --- contrib/ChangeLog | 4 ++++ contrib/gcc_update | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 5b38ad6614b..1a4557ec232 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2013-10-21 Mike Stump + + * gcc_update (configure): Update to handle svn 1.8.1. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/contrib/gcc_update b/contrib/gcc_update index 10a5970f621..212a99fc7d9 100755 --- a/contrib/gcc_update +++ b/contrib/gcc_update @@ -382,7 +382,7 @@ case $vcs_type in fi revision=`$GCC_SVN info | awk '/Revision:/ { print $2 }'` - branch=`$GCC_SVN info | sed -ne "/URL:/ { + branch=`$GCC_SVN info | sed -ne "/^URL:/ { s,.*/trunk,trunk, s,.*/branches/,, s,.*/tags/,, -- cgit v1.2.3 From 576576d6810586fb48dcddde928fdc60a76130e5 Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Mon, 21 Oct 2013 21:40:14 +0000 Subject: gcc: 2013-10-21 Bill Schmidt Backport from mainline 2013-04-05 Bill Schmidt PR target/56843 * config/rs6000/rs6000.c (rs6000_emit_swdiv_high_precision): Remove. (rs6000_emit_swdiv_low_precision): Remove. (rs6000_emit_swdiv): Rewrite to handle between one and four iterations of Newton-Raphson generally; modify required number of iterations for some cases. * config/rs6000/rs6000.h (RS6000_RECIP_HIGH_PRECISION_P): Remove. gcc/testsuite: 2013-10-21 Bill Schmidt Backport from mainline 2013-04-05 Bill Schmidt PR target/56843 * gcc.target/powerpc/recip-1.c: Modify expected output. * gcc.target/powerpc/recip-3.c: Likewise. * gcc.target/powerpc/recip-4.c: Likewise. * gcc.target/powerpc/recip-5.c: Add expected output for iterations. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@203910 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.ibm | 13 +++ gcc/config/rs6000/rs6000.c | 129 ++++++++++++----------------- gcc/config/rs6000/rs6000.h | 3 - gcc/testsuite/ChangeLog.ibm | 11 +++ gcc/testsuite/gcc.target/powerpc/recip-1.c | 4 +- gcc/testsuite/gcc.target/powerpc/recip-3.c | 4 +- gcc/testsuite/gcc.target/powerpc/recip-4.c | 4 +- gcc/testsuite/gcc.target/powerpc/recip-5.c | 8 ++ 8 files changed, 92 insertions(+), 84 deletions(-) diff --git a/gcc/ChangeLog.ibm b/gcc/ChangeLog.ibm index b4b88e206e2..5aecb418ab4 100644 --- a/gcc/ChangeLog.ibm +++ b/gcc/ChangeLog.ibm @@ -1,3 +1,16 @@ +2013-10-21 Bill Schmidt + + Backport from mainline + 2013-04-05 Bill Schmidt + + PR target/56843 + * config/rs6000/rs6000.c (rs6000_emit_swdiv_high_precision): Remove. + (rs6000_emit_swdiv_low_precision): Remove. + (rs6000_emit_swdiv): Rewrite to handle between one and four + iterations of Newton-Raphson generally; modify required number of + iterations for some cases. + * config/rs6000/rs6000.h (RS6000_RECIP_HIGH_PRECISION_P): Remove. + 2013-10-17 Michael Meissner Backport from mainline diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 891cabd2a39..c38145b7fc0 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -28496,54 +28496,26 @@ rs6000_emit_nmsub (rtx dst, rtx m1, rtx m2, rtx a) emit_insn (gen_rtx_SET (VOIDmode, dst, r)); } -/* Newton-Raphson approximation of floating point divide with just 2 passes - (either single precision floating point, or newer machines with higher - accuracy estimates). Support both scalar and vector divide. Assumes no - trapping math and finite arguments. */ +/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P, + add a reg_note saying that this was a division. Support both scalar and + vector divide. Assumes no trapping math and finite arguments. */ -static void -rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d) +void +rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p) { enum machine_mode mode = GET_MODE (dst); - rtx x0, e0, e1, y1, u0, v0; - enum insn_code code = optab_handler (smul_optab, mode); - gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code); - rtx one = rs6000_load_constant_and_splat (mode, dconst1); - - gcc_assert (code != CODE_FOR_nothing); - - /* x0 = 1./d estimate */ - x0 = gen_reg_rtx (mode); - emit_insn (gen_rtx_SET (VOIDmode, x0, - gen_rtx_UNSPEC (mode, gen_rtvec (1, d), - UNSPEC_FRES))); - - e0 = gen_reg_rtx (mode); - rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - (d * x0) */ - - e1 = gen_reg_rtx (mode); - rs6000_emit_madd (e1, e0, e0, e0); /* e1 = (e0 * e0) + e0 */ - - y1 = gen_reg_rtx (mode); - rs6000_emit_madd (y1, e1, x0, x0); /* y1 = (e1 * x0) + x0 */ - - u0 = gen_reg_rtx (mode); - emit_insn (gen_mul (u0, n, y1)); /* u0 = n * y1 */ - - v0 = gen_reg_rtx (mode); - rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - (d * u0) */ - - rs6000_emit_madd (dst, v0, y1, u0); /* dst = (v0 * y1) + u0 */ -} + rtx one, x0, e0, x1, xprev, eprev, xnext, enext, u, v; + int i; -/* Newton-Raphson approximation of floating point divide that has a low - precision estimate. Assumes no trapping math and finite arguments. */ + /* Low precision estimates guarantee 5 bits of accuracy. High + precision estimates guarantee 14 bits of accuracy. SFmode + requires 23 bits of accuracy. DFmode requires 52 bits of + accuracy. Each pass at least doubles the accuracy, leading + to the following. */ + int passes = (TARGET_RECIP_PRECISION) ? 1 : 3; + if (mode == DFmode || mode == V2DFmode) + passes++; -static void -rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d) -{ - enum machine_mode mode = GET_MODE (dst); - rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one; enum insn_code code = optab_handler (smul_optab, mode); gen_2arg_fn_t gen_mul = (gen_2arg_fn_t) GEN_FCN (code); @@ -28557,46 +28529,44 @@ rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d) gen_rtx_UNSPEC (mode, gen_rtvec (1, d), UNSPEC_FRES))); - e0 = gen_reg_rtx (mode); - rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - d * x0 */ + /* Each iteration but the last calculates x_(i+1) = x_i * (2 - d * x_i). */ + if (passes > 1) { - y1 = gen_reg_rtx (mode); - rs6000_emit_madd (y1, e0, x0, x0); /* y1 = x0 + e0 * x0 */ + /* e0 = 1. - d * x0 */ + e0 = gen_reg_rtx (mode); + rs6000_emit_nmsub (e0, d, x0, one); - e1 = gen_reg_rtx (mode); - emit_insn (gen_mul (e1, e0, e0)); /* e1 = e0 * e0 */ + /* x1 = x0 + e0 * x0 */ + x1 = gen_reg_rtx (mode); + rs6000_emit_madd (x1, e0, x0, x0); - y2 = gen_reg_rtx (mode); - rs6000_emit_madd (y2, e1, y1, y1); /* y2 = y1 + e1 * y1 */ + for (i = 0, xprev = x1, eprev = e0; i < passes - 2; + ++i, xprev = xnext, eprev = enext) { + + /* enext = eprev * eprev */ + enext = gen_reg_rtx (mode); + emit_insn (gen_mul (enext, eprev, eprev)); - e2 = gen_reg_rtx (mode); - emit_insn (gen_mul (e2, e1, e1)); /* e2 = e1 * e1 */ + /* xnext = xprev + enext * xprev */ + xnext = gen_reg_rtx (mode); + rs6000_emit_madd (xnext, enext, xprev, xprev); + } - y3 = gen_reg_rtx (mode); - rs6000_emit_madd (y3, e2, y2, y2); /* y3 = y2 + e2 * y2 */ + } else + xprev = x0; - u0 = gen_reg_rtx (mode); - emit_insn (gen_mul (u0, n, y3)); /* u0 = n * y3 */ + /* The last iteration calculates x_(i+1) = n * x_i * (2 - d * x_i). */ - v0 = gen_reg_rtx (mode); - rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - d * u0 */ + /* u = n * xprev */ + u = gen_reg_rtx (mode); + emit_insn (gen_mul (u, n, xprev)); - rs6000_emit_madd (dst, v0, y3, u0); /* dst = u0 + v0 * y3 */ -} + /* v = n - (d * u) */ + v = gen_reg_rtx (mode); + rs6000_emit_nmsub (v, d, u, n); -/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P, - add a reg_note saying that this was a division. Support both scalar and - vector divide. Assumes no trapping math and finite arguments. */ - -void -rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p) -{ - enum machine_mode mode = GET_MODE (dst); - - if (RS6000_RECIP_HIGH_PRECISION_P (mode)) - rs6000_emit_swdiv_high_precision (dst, n, d); - else - rs6000_emit_swdiv_low_precision (dst, n, d); + /* dst = (v * xprev) + u */ + rs6000_emit_madd (dst, v, xprev, u); if (note_p) add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d)); @@ -28611,7 +28581,16 @@ rs6000_emit_swrsqrt (rtx dst, rtx src) enum machine_mode mode = GET_MODE (src); rtx x0 = gen_reg_rtx (mode); rtx y = gen_reg_rtx (mode); - int passes = (TARGET_RECIP_PRECISION) ? 2 : 3; + + /* Low precision estimates guarantee 5 bits of accuracy. High + precision estimates guarantee 14 bits of accuracy. SFmode + requires 23 bits of accuracy. DFmode requires 52 bits of + accuracy. Each pass at least doubles the accuracy, leading + to the following. */ + int passes = (TARGET_RECIP_PRECISION) ? 1 : 3; + if (mode == DFmode || mode == V2DFmode) + passes++; + REAL_VALUE_TYPE dconst3_2; int i; rtx halfthree; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 20225099644..4738620b3b4 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -673,9 +673,6 @@ extern unsigned char rs6000_recip_bits[]; #define RS6000_RECIP_AUTO_RSQRTE_P(MODE) \ (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RSQRTE) -#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \ - ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION) - /* The default CPU for TARGET_OPTION_OVERRIDE. */ #define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT diff --git a/gcc/testsuite/ChangeLog.ibm b/gcc/testsuite/ChangeLog.ibm index 891d477626f..efc86b0420f 100644 --- a/gcc/testsuite/ChangeLog.ibm +++ b/gcc/testsuite/ChangeLog.ibm @@ -1,3 +1,14 @@ +2013-10-21 Bill Schmidt + + Backport from mainline + 2013-04-05 Bill Schmidt + + PR target/56843 + * gcc.target/powerpc/recip-1.c: Modify expected output. + * gcc.target/powerpc/recip-3.c: Likewise. + * gcc.target/powerpc/recip-4.c: Likewise. + * gcc.target/powerpc/recip-5.c: Add expected output for iterations. + 2013-10-17 Michael Meissner Back port from mainline diff --git a/gcc/testsuite/gcc.target/powerpc/recip-1.c b/gcc/testsuite/gcc.target/powerpc/recip-1.c index 4ae0c4f119f..59660e35bd5 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-1.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-1.c @@ -3,8 +3,8 @@ /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power6" } */ /* { dg-final { scan-assembler-times "frsqrte" 2 } } */ /* { dg-final { scan-assembler-times "fmsub" 2 } } */ -/* { dg-final { scan-assembler-times "fmul" 8 } } */ -/* { dg-final { scan-assembler-times "fnmsub" 4 } } */ +/* { dg-final { scan-assembler-times "fmul" 6 } } */ +/* { dg-final { scan-assembler-times "fnmsub" 3 } } */ double rsqrt_d (double a) diff --git a/gcc/testsuite/gcc.target/powerpc/recip-3.c b/gcc/testsuite/gcc.target/powerpc/recip-3.c index 238f8f36198..1f8e30572b2 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-3.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-3.c @@ -7,8 +7,8 @@ /* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 2 } } */ /* { dg-final { scan-assembler-times "xsrsqrtesp\|frsqrtes" 1 } } */ /* { dg-final { scan-assembler-times "xsmsub.sp\|fmsubs" 1 } } */ -/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 4 } } */ -/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */ +/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */ +/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 1 } } */ double rsqrt_d (double a) diff --git a/gcc/testsuite/gcc.target/powerpc/recip-4.c b/gcc/testsuite/gcc.target/powerpc/recip-4.c index 35eef6f0f0f..a62b60db201 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-4.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-4.c @@ -7,8 +7,8 @@ /* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */ /* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */ /* { dg-final { scan-assembler-times "xvmsub.sp" 1 } } */ -/* { dg-final { scan-assembler-times "xvmulsp" 4 } } */ -/* { dg-final { scan-assembler-times "xvnmsub.sp" 2 } } */ +/* { dg-final { scan-assembler-times "xvmulsp" 2 } } */ +/* { dg-final { scan-assembler-times "xvnmsub.sp" 1 } } */ #define SIZE 1024 diff --git a/gcc/testsuite/gcc.target/powerpc/recip-5.c b/gcc/testsuite/gcc.target/powerpc/recip-5.c index 902fb2674b3..53b74fa8c24 100644 --- a/gcc/testsuite/gcc.target/powerpc/recip-5.c +++ b/gcc/testsuite/gcc.target/powerpc/recip-5.c @@ -6,6 +6,14 @@ /* { dg-final { scan-assembler-times "xvresp" 5 } } */ /* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */ /* { dg-final { scan-assembler-times "xsresp\|fres" 2 } } */ +/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */ +/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */ +/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 2 } } */ +/* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 4 } } */ +/* { dg-final { scan-assembler-times "xvmulsp" 7 } } */ +/* { dg-final { scan-assembler-times "xvnmsub.sp" 5 } } */ +/* { dg-final { scan-assembler-times "xvmuldp" 6 } } */ +/* { dg-final { scan-assembler-times "xvnmsub.dp" 8 } } */ #include -- cgit v1.2.3 From 7c3a41c6638249c6d6d1a2bf48c2103968930470 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 22 Oct 2013 00:16:41 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203912 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index afcbcf061d6..9e483b6fdc9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131021 +20131022 -- cgit v1.2.3 From 7352bc99448f77006d84c38732b12d9e5eb13ffa Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 23 Oct 2013 00:17:06 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203943 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9e483b6fdc9..357fca20227 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131022 +20131023 -- cgit v1.2.3 From c8fbb813a057ee071d867cbcc0f8473951974aec Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 23 Oct 2013 11:59:05 +0000 Subject: 2013-10-23 Richard Biener Backport from mainline 2013-06-24 Richard Biener PR tree-optimization/57488 * tree-ssa-pre.c (insert): Clear NEW sets before each iteration. * gcc.dg/torture/pr57488.c: New testcase. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203958 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 +++++ gcc/testsuite/ChangeLog | 10 ++++++ gcc/testsuite/gcc.dg/torture/pr57488.c | 58 ++++++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/torture/pr58830.c | 42 ++++++++++++++++++++++++ gcc/tree-ssa-pre.c | 6 ++++ 5 files changed, 124 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr57488.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr58830.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e4bf656a55..efde43d2b1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-10-23 Richard Biener + + Backport from mainline + 2013-06-24 Richard Biener + + PR tree-optimization/57488 + * tree-ssa-pre.c (insert): Clear NEW sets before each iteration. + 2013-10-16 Ganesh Gopalasubramanian Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48c8bc2b3fa..442aff4dd67 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2013-10-23 Richard Biener + + * gcc.dg/torture/pr58830.c: New testcase. + + Backport from mainline + 2013-06-24 Richard Biener + + PR tree-optimization/57488 + * gcc.dg/torture/pr57488.c: New testcase. + 2013-10-19 Oleg Endo * gcc.target/sh/pr54089-3.c: Fix test for load of constant 31. diff --git a/gcc/testsuite/gcc.dg/torture/pr57488.c b/gcc/testsuite/gcc.dg/torture/pr57488.c new file mode 100644 index 00000000000..7eda36476e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57488.c @@ -0,0 +1,58 @@ +/* { dg-do run } */ + +extern void abort (void); + +int i, j, *pj = &j, **ppj = &pj; +int x, *px = &x; + +short s, *ps = &s, k; + +unsigned short u, *pu = &u, **ppu = &pu; + +char c, *pc = &c; + +unsigned char v = 48; + +static int +bar (int p) +{ + p = k; + *px = **ppu = i; + *ppj = &p; + if (**ppj) + *pj = p; + return p; +} + +void __attribute__((noinline)) +foo () +{ + for (; i <= 3; i++) + for (; j; j--); + + u ^= bar (*pj); + + for (k = 1; k >= 0; k--) + { + int l; + bar (0); + for (l = 1; l < 5; l++) + { + int m; + for (m = 6; m; m--) + { + v--; + *ps = *pc; + } + } + } +} + +int +main () +{ + foo (); + if (v != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr58830.c b/gcc/testsuite/gcc.dg/torture/pr58830.c new file mode 100644 index 00000000000..8081f8b2c27 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58830.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-pre -ftree-partial-pre" } */ + +extern void abort (void); + +int b, c, d, f, g, h, i, j[6], *l = &b, *m, n, *o, r; +char k; + +static int +foo () +{ + char *p = &k; + + for (; d; d++) + if (i) + h = 0; + else + h = c || (r = 0); + + for (f = 0; f < 2; f++) + { + unsigned int q; + *l = 0; + if (n) + *m = g; + if (g) + o = 0; + for (q = -8; q >= 5; q++) + (*p)--; + } + + return 0; +} + +int +main () +{ + foo (); + if (j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[j[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ^ (k & 15)] != 0) + abort (); + return 0; +} diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 10c8091758e..3e6a82e24ab 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3664,6 +3664,12 @@ insert (void) if (dump_file && dump_flags & TDF_DETAILS) fprintf (dump_file, "Starting insert iteration %d\n", num_iterations); new_stuff = insert_aux (ENTRY_BLOCK_PTR); + + /* Clear the NEW sets before the next iteration. We have already + fully propagated its contents. */ + if (new_stuff) + FOR_ALL_BB (bb) + bitmap_set_free (NEW_SETS (bb)); } statistics_histogram_event (cfun, "insert iterations", num_iterations); } -- cgit v1.2.3 From 572b2e387b4b96b63d864acc5507158a57a3cb03 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 23 Oct 2013 19:16:55 +0000 Subject: Add missing check in stmt_local_def for tail-merge. 2013-10-23 Tom de Vries PR tree-optimization/58805 * tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check. * gcc.dg/pr58805.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203990 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr58805.c | 24 ++++++++++++++++++++++++ gcc/tree-ssa-tail-merge.c | 3 ++- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr58805.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index efde43d2b1a..adf47eaa66b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-10-23 Tom de Vries + + PR tree-optimization/58805 + * tree-ssa-tail-merge.c (stmt_local_def): Add gimple_vdef check. + 2013-10-23 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 442aff4dd67..6f7325c5bbb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-23 Tom de Vries + + PR tree-optimization/58805 + * gcc.dg/pr58805.c: New test. + 2013-10-23 Richard Biener * gcc.dg/torture/pr58830.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/pr58805.c b/gcc/testsuite/gcc.dg/pr58805.c new file mode 100644 index 00000000000..dda0e4bdf4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr58805.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ + +/* Type that matches the 'p' constraint. */ +#define TYPE void * + +static inline +void bar (TYPE *r) +{ + TYPE t; + __asm__ ("" : "=&p" (t), "=p" (*r)); +} + +void +foo (int n, TYPE *x, TYPE *y) +{ + if (n == 0) + bar (x); + else + bar (y); +} + +/* { dg-final { scan-tree-dump-times "__asm__" 2 "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index b20d3067d66..419b4ec024e 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -297,7 +297,8 @@ stmt_local_def (gimple stmt) tree val; def_operand_p def_p; - if (gimple_has_side_effects (stmt)) + if (gimple_has_side_effects (stmt) + || gimple_vdef (stmt) != NULL_TREE) return false; def_p = SINGLE_SSA_DEF_OPERAND (stmt, SSA_OP_DEF); -- cgit v1.2.3 From da1a61c9a0222ea6eb1b3097e0f229f58d36f15e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 24 Oct 2013 00:16:46 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@203999 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 357fca20227..f1561f431b8 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131023 +20131024 -- cgit v1.2.3 From f12a833d0daeba0d3c7d3d2491600eb160fcaf14 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Thu, 24 Oct 2013 12:53:51 +0000 Subject: Backport from mainline 2013-10-23 David Edelsohn PR target/58838 * config/rs6000/rs6000.md (mulsi3_internal1 and splitter): Add TARGET_32BIT final condition. (mulsi3_internal2 and splitter): Same. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204009 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/rs6000/rs6000.md | 8 ++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index adf47eaa66b..36731537aa6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-10-24 David Edelsohn + + Backport from mainline + 2013-10-23 David Edelsohn + + PR target/58838 + * config/rs6000/rs6000.md (mulsi3_internal1 and splitter): Add + TARGET_32BIT final condition. + (mulsi3_internal2 and splitter): Same. + 2013-10-23 Tom de Vries PR tree-optimization/58805 diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index ade39ea5f90..fe7d2fd5520 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -2412,7 +2412,7 @@ (match_operand:SI 2 "gpc_reg_operand" "r,r")) (const_int 0))) (clobber (match_scratch:SI 3 "=r,r"))] - "" + "TARGET_32BIT" "@ mullw. %3,%1,%2 #" @@ -2425,7 +2425,7 @@ (match_operand:SI 2 "gpc_reg_operand" "")) (const_int 0))) (clobber (match_scratch:SI 3 ""))] - "reload_completed" + "TARGET_32BIT && reload_completed" [(set (match_dup 3) (mult:SI (match_dup 1) (match_dup 2))) (set (match_dup 0) @@ -2440,7 +2440,7 @@ (const_int 0))) (set (match_operand:SI 0 "gpc_reg_operand" "=r,r") (mult:SI (match_dup 1) (match_dup 2)))] - "" + "TARGET_32BIT" "@ mullw. %0,%1,%2 #" @@ -2454,7 +2454,7 @@ (const_int 0))) (set (match_operand:SI 0 "gpc_reg_operand" "") (mult:SI (match_dup 1) (match_dup 2)))] - "reload_completed" + "TARGET_32BIT && reload_completed" [(set (match_dup 0) (mult:SI (match_dup 1) (match_dup 2))) (set (match_dup 3) -- cgit v1.2.3 From 894f5182ad21b9cdf82e7aeb15cdcc5a2126119f Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 25 Oct 2013 00:16:51 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204042 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index f1561f431b8..ef96cfede36 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131024 +20131025 -- cgit v1.2.3 From 253cd1cc476c69ed43389ffa732e73119b4fd231 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 25 Oct 2013 08:56:11 +0000 Subject: * recog.c (search_ofs): New static variable moved from... (peep2_find_free_register): ...here. (peephole2_optimize): Initialize it. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204051 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/recog.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36731537aa6..9c143cb8101 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-10-25 Eric Botcazou + + * recog.c (search_ofs): New static variable moved from... + (peep2_find_free_register): ...here. + (peephole2_optimize): Initialize it. + 2013-10-24 David Edelsohn Backport from mainline diff --git a/gcc/recog.c b/gcc/recog.c index f00859cf00a..ad096301c9e 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3061,6 +3061,9 @@ peep2_reg_dead_p (int ofs, rtx reg) return 1; } +/* Regno offset to be used in the register search. */ +static int search_ofs; + /* Try to find a hard register of mode MODE, matching the register class in CLASS_STR, which is available at the beginning of insn CURRENT_INSN and remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX, @@ -3076,7 +3079,6 @@ rtx peep2_find_free_register (int from, int to, const char *class_str, enum machine_mode mode, HARD_REG_SET *reg_set) { - static int search_ofs; enum reg_class cl; HARD_REG_SET live; df_ref *def_rec; @@ -3541,6 +3543,7 @@ peephole2_optimize (void) /* Initialize the regsets we're going to use. */ for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) peep2_insn_data[i].live_before = BITMAP_ALLOC (®_obstack); + search_ofs = 0; live = BITMAP_ALLOC (®_obstack); FOR_EACH_BB_REVERSE (bb) -- cgit v1.2.3 From ab2d639dc7ca48ba998982fc586cdc7bb541ae49 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 25 Oct 2013 09:24:02 +0000 Subject: PR rtl-optimization/58831 * alias.c (init_alias_analysis): At the beginning of each iteration, set the reg_seen[N] bit if static_reg_base_value[N] is non-null. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204056 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++ gcc/alias.c | 17 +++++------- gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.c-torture/execute/pr58831.c | 40 +++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58831.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c143cb8101..3499cfccd37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-10-25 Eric Botcazou + + PR rtl-optimization/58831 + * alias.c (init_alias_analysis): At the beginning of each iteration, set + the reg_seen[N] bit if static_reg_base_value[N] is non-null. + 2013-10-25 Eric Botcazou * recog.c (search_ofs): New static variable moved from... diff --git a/gcc/alias.c b/gcc/alias.c index 970bdb0ee9a..aa404a7ab49 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -2871,16 +2871,13 @@ init_alias_analysis (void) /* Wipe the reg_seen array clean. */ bitmap_clear (reg_seen); - /* Mark all hard registers which may contain an address. - The stack, frame and argument pointers may contain an address. - An argument register which can hold a Pmode value may contain - an address even if it is not in BASE_REGS. - - The address expression is VOIDmode for an argument and - Pmode for other registers. */ - - memcpy (new_reg_base_value, static_reg_base_value, - FIRST_PSEUDO_REGISTER * sizeof (rtx)); + /* Initialize the alias information for this pass. */ + for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (static_reg_base_value[i]) + { + new_reg_base_value[i] = static_reg_base_value[i]; + bitmap_set_bit (reg_seen, i); + } /* Walk the insns adding values to the new_reg_base_value array. */ for (i = 0; i < rpo_cnt; i++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6f7325c5bbb..529aaa72c6f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-25 Eric Botcazou + + * gcc.c-torture/execute/pr58831.c: New test. + 2013-10-23 Tom de Vries PR tree-optimization/58805 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58831.c b/gcc/testsuite/gcc.c-torture/execute/pr58831.c new file mode 100644 index 00000000000..a40cd54d222 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58831.c @@ -0,0 +1,40 @@ +#include + +int a, *b, c, d, f, **i, p, q, *r; +short o, j; + +static int __attribute__((noinline, noclone)) +fn1 (int *p1, int **p2) +{ + int **e = &b; + for (; p; p++) + *p1 = 1; + *e = *p2 = &d; + + assert (r); + + return c; +} + +static int ** __attribute__((noinline, noclone)) +fn2 (void) +{ + for (f = 0; f != 42; f++) + { + int *g[3] = {0, 0, 0}; + for (o = 0; o; o--) + for (; a > 1;) + { + int **h[1] = { &g[2] }; + } + } + return &r; +} + +int +main (void) +{ + i = fn2 (); + fn1 (b, i); + return 0; +} -- cgit v1.2.3 From 20b40b08dfc1307eef38aac9325f52d66865ef12 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 25 Oct 2013 13:49:48 +0000 Subject: 2013-10-25 Tom de Vries PR c++/58282 * except.c (build_must_not_throw_expr): Handle flag_exceptions. * g++.dg/tm/noexcept-6.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204067 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/except.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/tm/noexcept-6.C | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tm/noexcept-6.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d411523bbc7..1e8579e8362 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-25 Tom de Vries + + PR c++/58282 + * except.c (build_must_not_throw_expr): Handle + flag_exceptions. + 2013-10-17 Paolo Carlini PR c++/58596 diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 216ec103f52..604f274fb97 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -380,6 +380,9 @@ build_must_not_throw_expr (tree body, tree cond) { tree type = body ? TREE_TYPE (body) : void_type_node; + if (!flag_exceptions) + return body; + if (cond && !value_dependent_expression_p (cond)) { cond = cxx_constant_value (cond); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 529aaa72c6f..95aaccea790 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-25 Tom de Vries + + PR c++/58282 + * g++.dg/tm/noexcept-6.C: New test. + 2013-10-25 Eric Botcazou * gcc.c-torture/execute/pr58831.c: New test. diff --git a/gcc/testsuite/g++.dg/tm/noexcept-6.C b/gcc/testsuite/g++.dg/tm/noexcept-6.C new file mode 100644 index 00000000000..4391159e235 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/noexcept-6.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-fno-exceptions -fgnu-tm -O -std=c++0x -fdump-tree-tmlower" } + +struct TrueFalse +{ + static constexpr bool v() { return true; } +}; + +int global; + +template int foo() +{ + return __transaction_atomic noexcept(T::v()) (global + 1); +} + +int f1() +{ + return foo(); +} + +/* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */ +/* { dg-final { scan-tree-dump-times "__transaction_atomic" 1 "tmlower" } } */ +/* { dg-final { cleanup-tree-dump "tmlower" } } */ -- cgit v1.2.3 From 586454fb1dc32a2bf8b98649735268a4a981fccd Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 25 Oct 2013 20:06:20 +0000 Subject: PR rtl/58542 * optabs.c (maybe_emit_atomic_exchange): Use create_input_operand instead of create_convert_operand_to. (maybe_emit_sync_lock_test_and_set): Likewise. (expand_atomic_compare_and_swap): Likewise. (maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204076 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 21 ++++++++++++++------ gcc/optabs.c | 16 ++++++--------- gcc/testsuite/ChangeLog | 37 ++++++++++++++++++++--------------- gcc/testsuite/gcc.dg/atomic-store-6.c | 13 ++++++++++++ 4 files changed, 55 insertions(+), 32 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/atomic-store-6.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3499cfccd37..5b1158f6946 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-08-25 Richard Henderson + + PR rtl/58542 + * optabs.c (maybe_emit_atomic_exchange): Use create_input_operand + instead of create_convert_operand_to. + (maybe_emit_sync_lock_test_and_set): Likewise. + (expand_atomic_compare_and_swap): Likewise. + (maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes. + 2013-10-25 Eric Botcazou PR rtl-optimization/58831 @@ -35,12 +44,12 @@ 2013-10-16 Ganesh Gopalasubramanian - Backport from mainline - 2013-10-16 Ganesh Gopalasubramanian - + Backport from mainline + 2013-10-16 Ganesh Gopalasubramanian + - * config/i386/i386.c (ix86_option_override_internal): Enable FMA4 - for AMD bdver3. + * config/i386/i386.c (ix86_option_override_internal): Enable FMA4 + for AMD bdver3. 2013-10-16 Jakub Jelinek @@ -688,7 +697,7 @@ 2013-07-31 Andreas Krebbel Backport from mainline - 2013-03-27 Andreas Krebbel + 2013-03-27 Andreas Krebbel * config/s390/s390.h (TARGET_FLT_EVAL_METHOD): Define. diff --git a/gcc/optabs.c b/gcc/optabs.c index a3051ad9d9a..fd7fe559eb8 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7035,8 +7035,7 @@ maybe_emit_atomic_exchange (rtx target, rtx mem, rtx val, enum memmodel model) create_output_operand (&ops[0], target, mode); create_fixed_operand (&ops[1], mem); - /* VAL may have been promoted to a wider mode. Shrink it if so. */ - create_convert_operand_to (&ops[2], val, mode, true); + create_input_operand (&ops[2], val, mode); create_integer_operand (&ops[3], model); if (maybe_expand_insn (icode, 4, ops)) return ops[0].value; @@ -7075,8 +7074,7 @@ maybe_emit_sync_lock_test_and_set (rtx target, rtx mem, rtx val, struct expand_operand ops[3]; create_output_operand (&ops[0], target, mode); create_fixed_operand (&ops[1], mem); - /* VAL may have been promoted to a wider mode. Shrink it if so. */ - create_convert_operand_to (&ops[2], val, mode, true); + create_input_operand (&ops[2], val, mode); if (maybe_expand_insn (icode, 3, ops)) return ops[0].value; } @@ -7118,8 +7116,6 @@ maybe_emit_compare_and_swap_exchange_loop (rtx target, rtx mem, rtx val) { if (!target || !register_operand (target, mode)) target = gen_reg_rtx (mode); - if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode) - val = convert_modes (mode, GET_MODE (val), val, 1); if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX)) return target; } @@ -7331,8 +7327,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, create_output_operand (&ops[0], target_bool, bool_mode); create_output_operand (&ops[1], target_oval, mode); create_fixed_operand (&ops[2], mem); - create_convert_operand_to (&ops[3], expected, mode, true); - create_convert_operand_to (&ops[4], desired, mode, true); + create_input_operand (&ops[3], expected, mode); + create_input_operand (&ops[4], desired, mode); create_integer_operand (&ops[5], is_weak); create_integer_operand (&ops[6], succ_model); create_integer_operand (&ops[7], fail_model); @@ -7353,8 +7349,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, create_output_operand (&ops[0], target_oval, mode); create_fixed_operand (&ops[1], mem); - create_convert_operand_to (&ops[2], expected, mode, true); - create_convert_operand_to (&ops[3], desired, mode, true); + create_input_operand (&ops[2], expected, mode); + create_input_operand (&ops[3], desired, mode); if (!maybe_expand_insn (icode, 4, ops)) return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 95aaccea790..64f5b136330 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-10-25 Richard Henderson + + PR rtl/58542 + * gcc.dg/atomic-store-6.c: New. + 2013-10-25 Tom de Vries PR c++/58282 @@ -78,9 +83,9 @@ Backport from mainline 2013-06-27 Andreas Krebbel - * gcc.target/s390/htm-1.c: New file. - * gcc.target/s390/htm-nofloat-1.c: New file. - * gcc.target/s390/htm-xl-intrin-1.c: New file. + * gcc.target/s390/htm-1.c: New file. + * gcc.target/s390/htm-nofloat-1.c: New file. + * gcc.target/s390/htm-xl-intrin-1.c: New file. 2013-10-04 Tobias Burnus @@ -346,8 +351,8 @@ Backport from mainline 2013-08-12 Perez Read - PR target/58132 - * gcc.target/i386/movabs-1.c: New test. + PR target/58132 + * gcc.target/i386/movabs-1.c: New test. 2013-08-11 Janus Weil @@ -662,8 +667,8 @@ 2013-05-09 Martin Jambor - PR middle-end/56988 - * gcc.dg/ipa/pr56988.c: New test. + PR middle-end/56988 + * gcc.dg/ipa/pr56988.c: New test. 2013-05-08 Marc Glisse @@ -740,7 +745,7 @@ 2013-04-25 Marek Polacek PR tree-optimization/57066 - * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. + * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. 2013-05-02 Jakub Jelinek @@ -766,32 +771,32 @@ Backport from mainline 2013-04-24 Vladimir Makarov - PR rtl-optimizations/57046 - * gcc.target/i386/pr57046.c: New test. + PR rtl-optimizations/57046 + * gcc.target/i386/pr57046.c: New test. 2013-05-02 Vladimir Makarov Backport from mainline 2013-04-22 Vladimir Makarov - PR target/57018 - * gcc.target/i386/pr57018.c: New test. + PR target/57018 + * gcc.target/i386/pr57018.c: New test. 2013-05-02 Vladimir Makarov Backport from mainline 2013-04-18 Jakub Jelinek - PR rtl-optimization/56999 - * g++.dg/opt/pr56999.C: New test. + PR rtl-optimization/56999 + * g++.dg/opt/pr56999.C: New test. 2013-05-02 Vladimir Makarov Backport from mainline 2013-04-19 Vladimir Makarov - PR rtl-optimization/56847 - * gcc.dg/pr56847.c: New test. + PR rtl-optimization/56847 + * gcc.dg/pr56847.c: New test. 2013-05-02 Ian Bolton diff --git a/gcc/testsuite/gcc.dg/atomic-store-6.c b/gcc/testsuite/gcc.dg/atomic-store-6.c new file mode 100644 index 00000000000..81499cd716b --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic-store-6.c @@ -0,0 +1,13 @@ +/* { dg-do run } */ +/* { dg-require-effective-target sync_int_128_runtime } */ +/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ + +__int128_t i; + +int main() +{ + __atomic_store_16(&i, -1, 0); + if (i != -1) + __builtin_abort(); + return 0; +} -- cgit v1.2.3 From b10ec5039998c4c0e80b60e84629c70aba55d2bc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 26 Oct 2013 00:17:00 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204082 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ef96cfede36..910afc47e97 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131025 +20131026 -- cgit v1.2.3 From 1dd48f73894a455ef47244228d1c94ce9b8d32ec Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sat, 26 Oct 2013 06:02:20 +0000 Subject: Backport from mainline 2013-10-22 Uros Bizjak PR target/58779 * config/i386/i386.c (put_condition_code) : Remove CCCmode handling. : Return 'c' suffix for CCCmode. : Return 'nc' suffix for CCCmode. (ix86_cc_mode) : Do not generate overflow checks. * config/i386/i386.md (*sub3_cconly_overflow): Remove. (*sub3_cc_overflow): Ditto. (*subsi3_zext_cc_overflow): Ditto. Backport from mainline 2013-10-19 Uros Bizjak PR target/58792 * config/i386/i386.c (ix86_function_value_regno): Add DX_REG, ST1_REG and XMM1_REG for 32bit and 64bit targets. Also add DI_REG and SI_REG for 64bit SYSV ABI targets. testsuite/ChangeLog: Backport from mainline 2013-10-22 Uros Bizjak PR target/58779 * gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY and MINUSCCZEXT defines. Update scan-assembler dg directive. * gcc.dg/torture/pr58779.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204087 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 +++++++++++++++++++ gcc/config/i386/i386.c | 43 ++++++++++++++++++-------------- gcc/config/i386/i386.md | 38 ++++++++++------------------ gcc/testsuite/ChangeLog | 10 ++++++++ gcc/testsuite/gcc.dg/torture/pr58779.c | 12 +++++++++ gcc/testsuite/gcc.target/i386/pr30315.c | 44 ++------------------------------- 6 files changed, 86 insertions(+), 86 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58779.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5b1158f6946..f57fe51c3ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-22 Uros Bizjak + + PR target/58779 + * config/i386/i386.c (put_condition_code) : + Remove CCCmode handling. + : Return 'c' suffix for CCCmode. + : Return 'nc' suffix for CCCmode. + (ix86_cc_mode) : Do not generate overflow checks. + * config/i386/i386.md (*sub3_cconly_overflow): Remove. + (*sub3_cc_overflow): Ditto. + (*subsi3_zext_cc_overflow): Ditto. + +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-19 Uros Bizjak + + PR target/58792 + * config/i386/i386.c (ix86_function_value_regno): Add DX_REG, + ST1_REG and XMM1_REG for 32bit and 64bit targets. Also add DI_REG + and SI_REG for 64bit SYSV ABI targets. + 2013-08-25 Richard Henderson PR rtl/58542 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 36bd80503f8..dca8d4ef9ff 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -7235,9 +7235,15 @@ ix86_function_value_regno_p (const unsigned int regno) switch (regno) { case AX_REG: + case DX_REG: return true; + case DI_REG: + case SI_REG: + return TARGET_64BIT && ix86_abi != MS_ABI; - case FIRST_FLOAT_REG: + /* Complex values are returned in %st(0)/%st(1) pair. */ + case ST0_REG: + case ST1_REG: /* TODO: The function should depend on current function ABI but builtins.c would need updating then. Therefore we use the default ABI. */ @@ -7245,10 +7251,12 @@ ix86_function_value_regno_p (const unsigned int regno) return false; return TARGET_FLOAT_RETURNS_IN_80387; - case FIRST_SSE_REG: + /* Complex values are returned in %xmm0/%xmm1 pair. */ + case XMM0_REG: + case XMM1_REG: return TARGET_SSE; - case FIRST_MMX_REG: + case MM0_REG: if (TARGET_MACHO || TARGET_64BIT) return false; return TARGET_MMX; @@ -13817,8 +13825,6 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse, Those same assemblers have the same but opposite lossage on cmov. */ if (mode == CCmode) suffix = fp ? "nbe" : "a"; - else if (mode == CCCmode) - suffix = "b"; else gcc_unreachable (); break; @@ -13840,8 +13846,12 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse, } break; case LTU: - gcc_assert (mode == CCmode || mode == CCCmode); - suffix = "b"; + if (mode == CCmode) + suffix = "b"; + else if (mode == CCCmode) + suffix = "c"; + else + gcc_unreachable (); break; case GE: switch (mode) @@ -13861,20 +13871,20 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse, } break; case GEU: - /* ??? As above. */ - gcc_assert (mode == CCmode || mode == CCCmode); - suffix = fp ? "nb" : "ae"; + if (mode == CCmode) + suffix = fp ? "nb" : "ae"; + else if (mode == CCCmode) + suffix = "nc"; + else + gcc_unreachable (); break; case LE: gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode); suffix = "le"; break; case LEU: - /* ??? As above. */ if (mode == CCmode) suffix = "be"; - else if (mode == CCCmode) - suffix = fp ? "nb" : "ae"; else gcc_unreachable (); break; @@ -18486,12 +18496,7 @@ ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1) return CCmode; case GTU: /* CF=0 & ZF=0 */ case LEU: /* CF=1 | ZF=1 */ - /* Detect overflow checks. They need just the carry flag. */ - if (GET_CODE (op0) == MINUS - && rtx_equal_p (op1, XEXP (op0, 0))) - return CCCmode; - else - return CCmode; + return CCmode; /* Codes possibly doable only with sign flag when comparing against zero. */ case GE: /* SF=OF or SF=0 */ diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 4d5b2872d09..126f2b37f45 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -6589,7 +6589,7 @@ (set_attr "use_carry" "1") (set_attr "mode" "")]) -;; Overflow setting add and subtract instructions +;; Overflow setting add instructions (define_insn "*add3_cconly_overflow" [(set (reg:CCC FLAGS_REG) @@ -6604,43 +6604,31 @@ [(set_attr "type" "alu") (set_attr "mode" "")]) -(define_insn "*sub3_cconly_overflow" +(define_insn "*add3_cc_overflow" [(set (reg:CCC FLAGS_REG) (compare:CCC - (minus:SWI - (match_operand:SWI 0 "nonimmediate_operand" "m,") - (match_operand:SWI 1 "" ",m")) - (match_dup 0)))] - "" - "cmp{}\t{%1, %0|%0, %1}" - [(set_attr "type" "icmp") - (set_attr "mode" "")]) - -(define_insn "*3_cc_overflow" - [(set (reg:CCC FLAGS_REG) - (compare:CCC - (plusminus:SWI - (match_operand:SWI 1 "nonimmediate_operand" "0,0") + (plus:SWI + (match_operand:SWI 1 "nonimmediate_operand" "%0,0") (match_operand:SWI 2 "" ",m")) (match_dup 1))) (set (match_operand:SWI 0 "nonimmediate_operand" "=m,") - (plusminus:SWI (match_dup 1) (match_dup 2)))] - "ix86_binary_operator_ok (, mode, operands)" - "{}\t{%2, %0|%0, %2}" + (plus:SWI (match_dup 1) (match_dup 2)))] + "ix86_binary_operator_ok (PLUS, mode, operands)" + "add{}\t{%2, %0|%0, %2}" [(set_attr "type" "alu") (set_attr "mode" "")]) -(define_insn "*si3_zext_cc_overflow" +(define_insn "*addsi3_zext_cc_overflow" [(set (reg:CCC FLAGS_REG) (compare:CCC - (plusminus:SI - (match_operand:SI 1 "nonimmediate_operand" "0") + (plus:SI + (match_operand:SI 1 "nonimmediate_operand" "%0") (match_operand:SI 2 "x86_64_general_operand" "rme")) (match_dup 1))) (set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI (plusminus:SI (match_dup 1) (match_dup 2))))] - "TARGET_64BIT && ix86_binary_operator_ok (, SImode, operands)" - "{l}\t{%2, %k0|%k0, %2}" + (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] + "TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)" + "add{l}\t{%2, %k0|%k0, %2}" [(set_attr "type" "alu") (set_attr "mode" "SI")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 64f5b136330..c74595dc2be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2013-10-26 Uros Bizjak + + Backport from mainline + 2013-10-22 Uros Bizjak + + PR target/58779 + * gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY + and MINUSCCZEXT defines. Update scan-assembler dg directive. + * gcc.dg/torture/pr58779.c: New test. + 2013-10-25 Richard Henderson PR rtl/58542 diff --git a/gcc/testsuite/gcc.dg/torture/pr58779.c b/gcc/testsuite/gcc.dg/torture/pr58779.c new file mode 100644 index 00000000000..b0c0c869513 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58779.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ + +int a, c; + +int main () +{ + int e = -1; + short d = (c <= 0) ^ e; + if ((unsigned int) a - (a || d) <= (unsigned int) a) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr30315.c b/gcc/testsuite/gcc.target/i386/pr30315.c index 998d5071e5c..557b4f75174 100644 --- a/gcc/testsuite/gcc.target/i386/pr30315.c +++ b/gcc/testsuite/gcc.target/i386/pr30315.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -/* { dg-final { scan-assembler-times "cmp" 4 } } */ +/* { dg-final { scan-assembler-not "cmp" } } */ extern void abort (void); int c; @@ -34,39 +34,10 @@ void pluscconly##t##C (T a, T b) \ } #define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b) -#define MINUSCC(T, t) \ -T minuscc##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - abort (); \ - return difference; \ -} - -#define DECCC(T, t) \ -T deccc##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - c --; \ - return difference; \ -} - -#define MINUSCCONLY(T, t) \ -void minuscconly##t (T a, T b) \ -{ \ - T difference = a - b; \ - if (difference > a) \ - abort (); \ -} - #define TEST(T, t) \ PLUSCC(T, t) \ PLUSCCONLY(T, t) \ - INCCC(T, t) \ - MINUSCC(T, t) \ - MINUSCCONLY(T, t) \ - DECCC(T, t) + INCCC(T, t) TEST (unsigned long, l) TEST (unsigned int, i) @@ -84,14 +55,3 @@ unsigned long pluscczext##C (unsigned int a, unsigned int b) \ PLUSCCZEXT(a) PLUSCCZEXT(b) - -#define MINUSCCZEXT \ -unsigned long minuscczext (unsigned int a, unsigned int b) \ -{ \ - unsigned int difference = a - b; \ - if (difference > a) \ - abort (); \ - return difference; \ -} - -MINUSCCZEXT -- cgit v1.2.3 From f39824b326d1e980e49897741b6c80f09cf004a4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 27 Oct 2013 00:16:59 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 910afc47e97..58c671ace70 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131026 +20131027 -- cgit v1.2.3 From adba935f6dc71b8bc67d35ddfedda7f279679b19 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 28 Oct 2013 00:16:48 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204114 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 58c671ace70..c22dba10082 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131027 +20131028 -- cgit v1.2.3 From e3504a0c5f4c99f5425881f59722f9118e8b40d0 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 28 Oct 2013 08:35:28 +0000 Subject: Fix line number data for PIC register setup code. 2013-10-28 Tom de Vries * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. Don't commit insertions after NOTE_INSN_FUNCTION_BEG. * gcc.target/arm/require-pic-register-loc.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204120 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 ++++ gcc/cfgexpand.c | 12 ++++++--- gcc/testsuite/ChangeLog | 4 +++ .../gcc.target/arm/require-pic-register-loc.c | 29 ++++++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arm/require-pic-register-loc.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f57fe51c3ab..a4e70c00e0e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-10-28 Tom de Vries + + * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. + Don't commit insertions after NOTE_INSN_FUNCTION_BEG. + 2013-10-26 Uros Bizjak Backport from mainline diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 5acc42d73f5..5cc9c34f568 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -4707,14 +4707,18 @@ gimple_expand_cfg (void) if (e->insns.r) { rebuild_jump_labels_chain (e->insns.r); - /* Avoid putting insns before parm_birth_insn. */ + /* Put insns after parm birth, but before + NOTE_INSNS_FUNCTION_BEG. */ if (e->src == ENTRY_BLOCK_PTR - && single_succ_p (ENTRY_BLOCK_PTR) - && parm_birth_insn) + && single_succ_p (ENTRY_BLOCK_PTR)) { rtx insns = e->insns.r; e->insns.r = NULL_RTX; - emit_insn_after_noloc (insns, parm_birth_insn, e->dest); + if (NOTE_P (parm_birth_insn) + && NOTE_KIND (parm_birth_insn) == NOTE_INSN_FUNCTION_BEG) + emit_insn_before_noloc (insns, parm_birth_insn, e->dest); + else + emit_insn_after_noloc (insns, parm_birth_insn, e->dest); } else commit_one_edge_insertion (e); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c74595dc2be..d296afe2b0a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2013-10-28 Tom de Vries + + * gcc.target/arm/require-pic-register-loc.c: New test. + 2013-10-26 Uros Bizjak Backport from mainline diff --git a/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c b/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c new file mode 100644 index 00000000000..bd85e8640c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/require-pic-register-loc.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-g -fPIC" } */ + +void *v; +void a (void *x) { } +void b (void) { } + /* line 7. */ +int /* line 8. */ +main (int argc) /* line 9. */ +{ /* line 10. */ + if (argc == 12345) /* line 11. */ + { + a (v); + return 1; + } + b (); + + return 0; +} + +/* { dg-final { scan-assembler-not "\.loc 1 7 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 8 0" } } */ +/* { dg-final { scan-assembler-not "\.loc 1 9 0" } } */ + +/* The loc at the start of the prologue. */ +/* { dg-final { scan-assembler-times "\.loc 1 10 0" 1 } } */ + +/* The loc at the end of the prologue, with the first user line. */ +/* { dg-final { scan-assembler-times "\.loc 1 11 0" 1 } } */ -- cgit v1.2.3 From fabe2cdb5e179d3a758da67d40d72365f011df7c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 29 Oct 2013 00:16:51 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204144 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c22dba10082..6049607f681 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131028 +20131029 -- cgit v1.2.3 From 4ed37d084d54460cd84ce3a2ddf4e4095859555a Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Tue, 29 Oct 2013 14:32:13 +0000 Subject: 2013-10-29 Martin Jambor PR middle-end/58789 Backport from mainline 2013-05-09 Martin Jambor PR lto/57084 * gimple-fold.c (canonicalize_constructor_val): Call cgraph_get_create_real_symbol_node instead of cgraph_get_create_node. Backport from mainline 2013-03-16 Jan Hubicka * cgraph.h (cgraph_get_create_real_symbol_node): Declare. * cgraph.c (cgraph_get_create_real_symbol_node): New function. * cgrpahbuild.c: Use cgraph_get_create_real_symbol_node instead of cgraph_get_create_node. * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204163 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 19 +++++++++++++++++++ gcc/cgraph.c | 43 +++++++++++++++++++++++++++++++++++++++++++ gcc/cgraph.h | 1 + gcc/cgraphbuild.c | 14 +++++++------- gcc/gimple-fold.c | 2 +- gcc/ipa-prop.c | 27 +-------------------------- 6 files changed, 72 insertions(+), 34 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4e70c00e0e..03853af82be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2013-10-29 Martin Jambor + + PR middle-end/58789 + Backport from mainline + 2013-05-09 Martin Jambor + + PR lto/57084 + * gimple-fold.c (canonicalize_constructor_val): Call + cgraph_get_create_real_symbol_node instead of cgraph_get_create_node. + + Backport from mainline + 2013-03-16 Jan Hubicka + + * cgraph.h (cgraph_get_create_real_symbol_node): Declare. + * cgraph.c (cgraph_get_create_real_symbol_node): New function. + * cgrpahbuild.c: Use cgraph_get_create_real_symbol_node instead + of cgraph_get_create_node. + * ipa-prop.c (ipa_make_edge_direct_to_target): Likewise. + 2013-10-28 Tom de Vries * cfgexpand.c (gimple_expand_cfg): Remove test for parm_birth_insn. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 8c1efb4c37a..fd3aadee45d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2596,4 +2596,47 @@ verify_cgraph (void) FOR_EACH_FUNCTION (node) verify_cgraph_node (node); } + +/* Create external decl node for DECL. + The difference i nbetween cgraph_get_create_node and + cgraph_get_create_real_symbol_node is that cgraph_get_create_node + may return inline clone, while cgraph_get_create_real_symbol_node + will create a new node in this case. + FIXME: This function should be removed once clones are put out of decl + hash. */ + +struct cgraph_node * +cgraph_get_create_real_symbol_node (tree decl) +{ + struct cgraph_node *first_clone = cgraph_get_node (decl); + struct cgraph_node *node; + /* create symbol table node. even if inline clone exists, we can not take + it as a target of non-inlined call. */ + node = cgraph_get_node (decl); + if (node && !node->global.inlined_to) + return node; + + node = cgraph_create_node (decl); + + /* ok, we previously inlined the function, then removed the offline copy and + now we want it back for external call. this can happen when devirtualizing + while inlining function called once that happens after extern inlined and + virtuals are already removed. in this case introduce the external node + and make it available for call. */ + if (first_clone) + { + first_clone->clone_of = node; + node->clones = first_clone; + symtab_prevail_in_asm_name_hash ((symtab_node) node); + symtab_insert_node_to_hashtable ((symtab_node) node); + if (dump_file) + fprintf (dump_file, "Introduced new external node " + "(%s/%i) and turned into root of the clone tree.\n", + xstrdup (cgraph_node_name (node)), node->uid); + } + else if (dump_file) + fprintf (dump_file, "Introduced new external node " + "(%s/%i).\n", xstrdup (cgraph_node_name (node)), node->uid); + return node; +} #include "gt-cgraph.h" diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 5df7fb478b4..8ab7ae18102 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -575,6 +575,7 @@ struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void); struct cgraph_node * cgraph_create_node (tree); struct cgraph_node * cgraph_create_empty_node (void); struct cgraph_node * cgraph_get_create_node (tree); +struct cgraph_node * cgraph_get_create_real_symbol_node (tree); struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree); struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT, HOST_WIDE_INT, tree, tree); diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index fb01f24ec07..a74a4c043e3 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -73,7 +73,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data) decl = get_base_var (*tp); if (TREE_CODE (decl) == FUNCTION_DECL) { - struct cgraph_node *node = cgraph_get_create_node (decl); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl); if (!ctx->only_vars) cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)ctx->varpool_node, @@ -143,7 +143,7 @@ record_eh_tables (struct cgraph_node *node, struct function *fun) { struct cgraph_node *per_node; - per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); + per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL); cgraph_mark_address_taken_node (per_node); } @@ -223,7 +223,7 @@ mark_address (gimple stmt, tree addr, void *data) addr = get_base_address (addr); if (TREE_CODE (addr) == FUNCTION_DECL) { - struct cgraph_node *node = cgraph_get_create_node (addr); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -252,7 +252,7 @@ mark_load (gimple stmt, tree t, void *data) { /* ??? This can happen on platforms with descriptors when these are directly manipulated in the code. Pretend that it's an address. */ - struct cgraph_node *node = cgraph_get_create_node (t); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (t); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -330,7 +330,7 @@ build_cgraph_edges (void) { tree fn = gimple_omp_parallel_child_fn (stmt); ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } if (gimple_code (stmt) == GIMPLE_OMP_TASK) @@ -338,12 +338,12 @@ build_cgraph_edges (void) tree fn = gimple_omp_task_child_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node) cgraph_get_create_node (fn), + (symtab_node) cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); fn = gimple_omp_task_copy_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } } diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index b9211a9add2..06edced86cd 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -178,7 +178,7 @@ canonicalize_constructor_val (tree cval, tree from_decl) /* Make sure we create a cgraph node for functions we'll reference. They can be non-existent if the reference comes from an entry of an external vtable for example. */ - cgraph_get_create_node (base); + cgraph_get_create_real_symbol_node (base); } /* Fixup types in global initializers. */ if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0))) diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index c62dc68a2b0..33e8d4d2115 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -2126,7 +2126,6 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) we may create the first reference to the object in the unit. */ if (!callee || callee->global.inlined_to) { - struct cgraph_node *first_clone = callee; /* We are better to ensure we can refer to it. In the case of static functions we are out of luck, since we already @@ -2142,31 +2141,7 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid); return NULL; } - - /* Create symbol table node. Even if inline clone exists, we can not take - it as a target of non-inlined call. */ - callee = cgraph_create_node (target); - - /* OK, we previously inlined the function, then removed the offline copy and - now we want it back for external call. This can happen when devirtualizing - while inlining function called once that happens after extern inlined and - virtuals are already removed. In this case introduce the external node - and make it available for call. */ - if (first_clone) - { - first_clone->clone_of = callee; - callee->clones = first_clone; - symtab_prevail_in_asm_name_hash ((symtab_node)callee); - symtab_insert_node_to_hashtable ((symtab_node)callee); - if (dump_file) - fprintf (dump_file, "ipa-prop: Introduced new external node " - "(%s/%i) and turned into root of the clone tree.\n", - xstrdup (cgraph_node_name (callee)), callee->uid); - } - else if (dump_file) - fprintf (dump_file, "ipa-prop: Introduced new external node " - "(%s/%i).\n", - xstrdup (cgraph_node_name (callee)), callee->uid); + callee = cgraph_get_create_real_symbol_node (target); } ipa_check_create_node_params (); -- cgit v1.2.3 From 6da558b55819b94905ad9f56d2f1beb1bc3bda6d Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 29 Oct 2013 15:44:15 +0000 Subject: Backport from mainline 2013-08-08 Richard Sandiford PR rtl-optimization/58079 * combine.c (combine_simplify_rtx): Avoid using SUBST if simplify_comparison has widened a comparison with an integer. testsuite/ChangeLog: Backport from mainline 2013-08-08 Richard Sandiford PR rtl-optimization/58079 * gcc.dg/torture/pr58079.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204165 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++ gcc/combine.c | 11 +++- gcc/testsuite/ChangeLog | 8 +++ gcc/testsuite/gcc.dg/torture/pr58079.c | 107 +++++++++++++++++++++++++++++++++ 4 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr58079.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03853af82be..d98f528d1ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2013-10-29 Uros Bizjak + + Backport from mainline + 2013-08-08 Richard Sandiford + + PR rtl-optimization/58079 + * combine.c (combine_simplify_rtx): Avoid using SUBST if + simplify_comparison has widened a comparison with an integer. + 2013-10-29 Martin Jambor PR middle-end/58789 diff --git a/gcc/combine.c b/gcc/combine.c index a589cfadb42..f65b7e419bd 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5798,8 +5798,15 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest, return x; } - /* If the code changed, return a whole new comparison. */ - if (new_code != code) + /* If the code changed, return a whole new comparison. + We also need to avoid using SUBST in cases where + simplify_comparison has widened a comparison with a CONST_INT, + since in that case the wider CONST_INT may fail the sanity + checks in do_SUBST. */ + if (new_code != code + || (CONST_INT_P (op1) + && GET_MODE (op0) != GET_MODE (XEXP (x, 0)) + && GET_MODE (op0) != GET_MODE (XEXP (x, 1)))) return gen_rtx_fmt_ee (new_code, mode, op0, op1); /* Otherwise, keep this operation, but maybe change its operands. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d296afe2b0a..3c958c945be 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-10-29 Uros Bizjak + + Backport from mainline + 2013-08-08 Richard Sandiford + + PR rtl-optimization/58079 + * gcc.dg/torture/pr58079.c: New test. + 2013-10-28 Tom de Vries * gcc.target/arm/require-pic-register-loc.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr58079.c b/gcc/testsuite/gcc.dg/torture/pr58079.c new file mode 100644 index 00000000000..99a30181f1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58079.c @@ -0,0 +1,107 @@ +/* { dg-options "-mlong-calls" { target mips*-*-* } } */ + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int __kernel_size_t; +typedef __kernel_size_t size_t; +struct list_head { + struct list_head *next; +}; + +struct dmx_ts_feed { + int is_filtering; +}; +struct dmx_section_feed { + u16 secbufp; + u16 seclen; + u16 tsfeedp; +}; + +typedef int (*dmx_ts_cb) ( + const u8 * buffer1, + size_t buffer1_length, + const u8 * buffer2, + size_t buffer2_length +); + +struct dvb_demux_feed { + union { + struct dmx_ts_feed ts; + struct dmx_section_feed sec; + } feed; + union { + dmx_ts_cb ts; + } cb; + int type; + u16 pid; + int ts_type; + struct list_head list_head; +}; + +struct dvb_demux { + int (*stop_feed)(struct dvb_demux_feed *feed); + struct list_head feed_list; +}; + + +static +inline +__attribute__((always_inline)) +u8 +payload(const u8 *tsp) +{ + if (tsp[3] & 0x20) { + return 184 - 1 - tsp[4]; + } + return 184; +} + +static +inline +__attribute__((always_inline)) +int +dvb_dmx_swfilter_payload(struct dvb_demux_feed *feed, const u8 *buf) +{ + int count = payload(buf); + int p; + if (count == 0) + return -1; + return feed->cb.ts(&buf[p], count, ((void *)0), 0); +} + +static +inline +__attribute__((always_inline)) +void +dvb_dmx_swfilter_packet_type(struct dvb_demux_feed *feed, const u8 *buf) +{ + switch (feed->type) { + case 0: + if (feed->ts_type & 1) { + dvb_dmx_swfilter_payload(feed, buf); + } + if (dvb_dmx_swfilter_section_packet(feed, buf) < 0) + feed->feed.sec.seclen = feed->feed.sec.secbufp = 0; + } +} + +static +void +dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) +{ + struct dvb_demux_feed *feed; + int dvr_done = 0; + + for (feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = ((&demux->feed_list)->next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );}); __builtin_prefetch(feed->list_head.next), &feed->list_head != (&demux->feed_list); feed = ({ const typeof( ((typeof(*feed) *)0)->list_head ) *__mptr = (feed->list_head.next); (typeof(*feed) *)( (char *)__mptr - __builtin_offsetof(typeof(*feed),list_head) );})) { + if (((((feed)->type == 0) && ((feed)->feed.ts.is_filtering) && (((feed)->ts_type & (1 | 8)) == 1))) && (dvr_done++)) + dvb_dmx_swfilter_packet_type(feed, buf); + else if (feed->pid == 0x2000) + feed->cb.ts(buf, 188, ((void *)0), 0); + } +} +void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count) +{ + while (count--) { + dvb_dmx_swfilter_packet(demux, buf); + } +} -- cgit v1.2.3 From e003112c074b820143f674b9d47f3bcd5d375c58 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 29 Oct 2013 21:58:27 +0000 Subject: PR libstdc++/58839 * include/bits/shared_ptr_base.h (__shared_ptr::__shared_ptr(unique_ptr&&)): Do not dereference pointer. * testsuite/20_util/shared_ptr/cons/58839.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204186 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 8 ++++++ libstdc++-v3/include/bits/shared_ptr_base.h | 2 +- .../testsuite/20_util/shared_ptr/cons/58839.cc | 29 ++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1dcf11522f9..c9d36bc3066 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2013-10-29 Jonathan Wakely + + PR libstdc++/58839 + * include/bits/shared_ptr_base.h + (__shared_ptr::__shared_ptr(unique_ptr&&)): Do not dereference + pointer. + * testsuite/20_util/shared_ptr/cons/58839.cc: New. + 2013-10-20 Chris Jefferson Paolo Carlini diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 5b0be418b53..c4845ddd50f 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -819,7 +819,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_ptr(__r.get()), _M_refcount() { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) - auto __tmp = std::__addressof(*__r.get()); + auto __tmp = __r.get(); _M_refcount = __shared_count<_Lp>(std::move(__r)); __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp); } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc new file mode 100644 index 00000000000..6ad256461ea --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// libstdc++/58839 + +void test01() +{ + std::unique_ptr y; + std::shared_ptr x = std::move(y); +} -- cgit v1.2.3 From 16661d2aeb94a76669b1e572d3a448f6006afbcc Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 30 Oct 2013 00:17:11 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204191 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6049607f681..aa1e6bce8f9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131029 +20131030 -- cgit v1.2.3 From 8ab20da73c783634d0032d5af4d6800b7e271d32 Mon Sep 17 00:00:00 2001 From: Chris Studholme Date: Wed, 30 Oct 2013 18:24:56 +0000 Subject: 2013-10-30 Chris Studholme PR libstdc++/58912 * include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace): Remove unnecessary initialization of storage buffer. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204221 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/shared_ptr_base.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c9d36bc3066..11cf9e30e27 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2013-10-30 Chris Studholme + + PR libstdc++/58912 + * include/bits/shared_ptr_base.h (_Sp_counted_ptr_inplace): Remove + unnecessary initialization of storage buffer. + 2013-10-29 Jonathan Wakely PR libstdc++/58839 diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index c4845ddd50f..9dcefa2ee6a 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -391,7 +391,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: template _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) - : _M_impl(__a), _M_storage() + : _M_impl(__a) { _M_impl._M_ptr = static_cast<_Tp*>(static_cast(&_M_storage)); // _GLIBCXX_RESOLVE_LIB_DEFECTS -- cgit v1.2.3 From aa26cff13b06f1777f35bd7b9cb7d569d2cc9bb4 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Thu, 31 Oct 2013 00:16:54 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204237 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index aa1e6bce8f9..7b874ef5c40 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131030 +20131031 -- cgit v1.2.3 From 0a2d8a73277c74867765bc20e214a2ca1ea7ddd2 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 31 Oct 2013 15:06:28 +0000 Subject: * testsuite/20_util/shared_ptr/cons/58839.cc: Do not use default_delete. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204264 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 11cf9e30e27..a29db1d6147 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2013-10-31 Jonathan Wakely + + * testsuite/20_util/shared_ptr/cons/58839.cc: Do not use + default_delete. + 2013-10-30 Chris Studholme PR libstdc++/58912 diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc index 6ad256461ea..f78a07fb2c6 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/58839.cc @@ -22,8 +22,12 @@ // libstdc++/58839 +struct D { + void operator()(void*) const noexcept { } +}; + void test01() { - std::unique_ptr y; + std::unique_ptr y; std::shared_ptr x = std::move(y); } -- cgit v1.2.3 From 3a1a65e38ec7b45e79bf4d1b6135d917ecad1730 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 1 Nov 2013 00:16:50 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204282 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7b874ef5c40..bbd1ee0457b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131031 +20131101 -- cgit v1.2.3 From 41cbcfcb4fccd3a34b1f3d290350f9a42cf29c0a Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 1 Nov 2013 11:16:56 +0000 Subject: 2013-11-01 Paolo Carlini PR libstdc++/58952 * include/c_global/cstdio: Undef getchar. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204292 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/include/c_global/cstdio | 1 + 2 files changed, 6 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a29db1d6147..3fb5d882a46 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2013-11-01 Paolo Carlini + + PR libstdc++/58952 + * include/c_global/cstdio: Undef getchar. + 2013-10-31 Jonathan Wakely * testsuite/20_util/shared_ptr/cons/58839.cc: Do not use diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio index fcbec0cf5b9..e81e4b1d82c 100644 --- a/libstdc++-v3/include/c_global/cstdio +++ b/libstdc++-v3/include/c_global/cstdio @@ -69,6 +69,7 @@ extern "C" char* gets (char* __s) __attribute__((deprecated)); #undef ftell #undef fwrite #undef getc +#undef getchar #undef gets #undef perror #undef printf -- cgit v1.2.3 From 6c77e5ad53bf454e86357326f198393ce5ecaeba Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 1 Nov 2013 22:27:04 +0000 Subject: * tr.po: Update. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204304 138bc75d-0d04-0410-961f-82ee72b054a4 --- libcpp/po/ChangeLog | 4 ++ libcpp/po/tr.po | 139 +++++++++++++++++++++------------------------------- 2 files changed, 60 insertions(+), 83 deletions(-) diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog index fab19320d38..f183084b9ad 100644 --- a/libcpp/po/ChangeLog +++ b/libcpp/po/ChangeLog @@ -1,3 +1,7 @@ +2013-11-01 Joseph Myers + + * tr.po: Update. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/libcpp/po/tr.po b/libcpp/po/tr.po index a25bc8ff75d..7e63bd1d9f9 100644 --- a/libcpp/po/tr.po +++ b/libcpp/po/tr.po @@ -1,20 +1,22 @@ # Turkish translations for cpplib messages. # Copyright (C) 2007 Free Software Foundation, Inc. +# This file is distributed under the same license as the gcc package. # # Nilgün Belma Bugüner , 2001, ..., 2007. +# Volkan Gezer , 2013. msgid "" msgstr "" -"Project-Id-Version: cpplib 4.2.0\n" +"Project-Id-Version: cpplib 4.8.0\n" "Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n" -"POT-Creation-Date: 2013-02-24 01:05+0000\n" -"PO-Revision-Date: 2007-05-23 01:17+0300\n" -"Last-Translator: Nilgün Belma Bugüner \n" +"POT-Creation-Date: 2013-03-15 17:42+0000\n" +"PO-Revision-Date: 2013-11-01 22:29+0100\n" +"Last-Translator: Volkan Gezer \n" "Language-Team: Turkish \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: KBabel 1.11.4\n" +"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: charset.c:673 @@ -121,10 +123,9 @@ msgid "non-ISO-standard escape sequence, '\\%c'" msgstr "ISO standardı olmayan önceleme dizgesi, '\\%c'" #: charset.c:1320 -#, fuzzy, c-format -#| msgid "unknown escape sequence '\\%c'" +#, c-format msgid "unknown escape sequence: '\\%c'" -msgstr "bilinmeyen önceleme dizgesi '\\%c'" +msgstr "bilinmeyen kaçış dizgesi: '\\%c'" #: charset.c:1328 #, c-format @@ -163,10 +164,9 @@ msgid "#%s is a GCC extension" msgstr "#%s bir GCC uzantısıdır" #: directives.c:362 -#, fuzzy, c-format -#| msgid "#%s is a GCC extension" +#, c-format msgid "#%s is a deprecated GCC extension" -msgstr "#%s bir GCC uzantısıdır" +msgstr "#%s eskimiş bir GCC uzantısıdır" #: directives.c:375 msgid "suggest not using #elif in traditional C" @@ -247,7 +247,7 @@ msgstr "satır yönergesinde geçersiz \"%s\" seçeneği" #: directives.c:909 msgid "unexpected end of file after #line" -msgstr "" +msgstr "#line satırından sonra beklenmeyen dosya sonu" #: directives.c:912 #, c-format @@ -271,7 +271,7 @@ msgstr "#'dan sonraki \"%s\" bir pozitif tamsayı değil" #: directives.c:1068 directives.c:1070 directives.c:1072 directives.c:1658 #, c-format msgid "%s" -msgstr "" +msgstr "%s" #: directives.c:1096 #, c-format @@ -312,16 +312,12 @@ msgid "#pragma once in main file" msgstr "main dosyasında '#pragma once'" #: directives.c:1462 -#, fuzzy -#| msgid "invalid #pragma GCC poison directive" msgid "invalid #pragma push_macro directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz #pragma güdümlü_makro yönergesi" #: directives.c:1517 -#, fuzzy -#| msgid "invalid #pragma GCC poison directive" msgid "invalid #pragma pop_macro directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz #pragma güdümlü_makro yönergesi" #: directives.c:1572 msgid "invalid #pragma GCC poison directive" @@ -347,10 +343,9 @@ msgid "current file is older than %s" msgstr "mevcut dosya %s den daha eski" #: directives.c:1653 -#, fuzzy, c-format -#| msgid "invalid #pragma GCC poison directive" +#, c-format msgid "invalid \"#pragma GCC %s\" directive" -msgstr "geçersiz #pragma GCC poison yönergesi" +msgstr "geçersiz \"#pragma GCC %s\" yönergesi" #: directives.c:1847 msgid "_Pragma takes a parenthesized string literal" @@ -405,7 +400,7 @@ msgstr "dayanak bir tanımlayıcı olmalı" msgid "\"%s\" re-asserted" msgstr "\"%s\" tekrar olumlanmış" -#: directives.c:2566 +#: directives.c:2567 #, c-format msgid "unterminated #%s" msgstr "sonlandırılmamış #%s" @@ -424,16 +419,12 @@ msgid "%s: %s" msgstr "%s: %s" #: expr.c:479 expr.c:577 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "fixed-point constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "sabit noktalı sabitler bir GCC uzantısıdır" #: expr.c:504 -#, fuzzy -#| msgid "invalid suffix \"%.*s\" on floating constant" msgid "invalid prefix \"0b\" for floating constant" -msgstr "gerçel sabitin \"%.*s\" soneki geçersiz" +msgstr "kayan nokta için geçerisz \"0b\" öntakısı" #: expr.c:514 msgid "use of C99 hexadecimal floating constant" @@ -450,10 +441,8 @@ msgid "traditional C rejects the \"%.*s\" suffix" msgstr "geleneksel C \"%.*s\" sonekini kullanmaz" #: expr.c:564 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "suffix for double constant is a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "çift sabit için öntakı bir GCC uzantısıdır" #: expr.c:570 #, c-format @@ -461,10 +450,8 @@ msgid "invalid suffix \"%.*s\" with hexadecimal floating constant" msgstr "onaltılık kayan sabitli \"%.*s\" soneki geçersiz" #: expr.c:581 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "decimal float constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "onluk kayan sabitler bir GCC uzantısıdır" #: expr.c:599 #, c-format @@ -472,10 +459,8 @@ msgid "invalid suffix \"%.*s\" on integer constant" msgstr "tamsayı sabitte sonek \"%.*s\" soneki geçersiz" #: expr.c:624 -#, fuzzy -#| msgid "use of C99 long long integer constant" msgid "use of C++0x long long integer constant" -msgstr "ISO C99 long long tamsayı sabitleri yasaklar" +msgstr "ISO C++0x long long tamsayı sabitlerinin kullanımı" #: expr.c:625 msgid "use of C99 long long integer constant" @@ -486,10 +471,8 @@ msgid "imaginary constants are a GCC extension" msgstr "sanal sabitler bir GCC genişletmesidir" #: expr.c:644 -#, fuzzy -#| msgid "imaginary constants are a GCC extension" msgid "binary constants are a GCC extension" -msgstr "sanal sabitler bir GCC genişletmesidir" +msgstr "ikili sabitler bir GCC uzantısıdır" #: expr.c:737 msgid "integer constant is too large for its type" @@ -517,10 +500,8 @@ msgid "this use of \"defined\" may not be portable" msgstr "\"defined\" bu kullanımıyla uyarlanabilir olmayabilir" #: expr.c:948 -#, fuzzy -#| msgid "integer overflow in preprocessor expression" msgid "user-defined literal in preprocessor expression" -msgstr "önişlemci ifadesinde tamsayı taşması" +msgstr "önişleyici ifadesinde kullanıcı tanımlı bağımlı" #: expr.c:953 msgid "floating constant in preprocessor expression" @@ -536,20 +517,17 @@ msgid "\"%s\" is not defined" msgstr "\"%s\" tanımlı değil" #: expr.c:1020 -#, fuzzy -#| msgid "#%s is a GCC extension" msgid "assertions are a GCC extension" -msgstr "#%s bir GCC uzantısıdır" +msgstr "belirteçler bir GCC uzantısıdır" #: expr.c:1023 msgid "assertions are a deprecated extension" -msgstr "" +msgstr "belirteçler artık kullanılmayan bir ifadedir" #: expr.c:1268 -#, fuzzy, c-format -#| msgid "unbalanced stack in #if" +#, c-format msgid "unbalanced stack in %s" -msgstr "#if ifadesinde karşılıksız yığın" +msgstr "%s içinde dengelenmemiş yığın" #: expr.c:1288 #, c-format @@ -594,39 +572,39 @@ msgstr "#if'in teriminde virgül" msgid "division by zero in #if" msgstr "#if içinde sıfırla bölme" -#: files.c:504 +#: files.c:505 msgid "NULL directory in find_file" msgstr "find_file içinde boş dizin" -#: files.c:542 +#: files.c:553 msgid "one or more PCH files were found, but they were invalid" msgstr "bir veya daha fazla PCH dosyası bulundu ama bunlar geçersiz" -#: files.c:545 +#: files.c:556 msgid "use -Winvalid-pch for more information" msgstr "daha fazla bilgi almak için -Winvalid-pch kullanın" -#: files.c:643 +#: files.c:660 #, c-format msgid "%s is a block device" msgstr "%s bir blok aygıtıdır" -#: files.c:660 +#: files.c:677 #, c-format msgid "%s is too large" msgstr "%s çok büyük" -#: files.c:700 +#: files.c:717 #, c-format msgid "%s is shorter than expected" msgstr "%s beklenenden daha kısa" -#: files.c:935 +#: files.c:953 #, c-format msgid "no include path in which to search for %s" msgstr "%s için aranacaklar içinde başlık dosyaları yolu yok" -#: files.c:1363 +#: files.c:1381 msgid "Multiple include guards may be useful for:\n" msgstr "Çoklu include önlemleri aşağıdakiler için kullanışlı olabilir:\n" @@ -717,27 +695,24 @@ msgstr "__VA_ARGS__ sadece argümanlarının sayısı değişebilen bir C99 mak #: lex.c:1178 lex.c:1255 #, c-format msgid "identifier \"%s\" is a special operator name in C++" -msgstr "" +msgstr "\"%s\" belirteci, C++'da özel bir işleç adıdır" #: lex.c:1399 msgid "raw string delimiter longer than 16 characters" -msgstr "" +msgstr "ham dizge ayracı 16 karakterden uzun" #: lex.c:1402 -#, fuzzy, c-format -#| msgid "universal character %.*s is not valid in an identifier" +#, c-format msgid "invalid character '%c' in raw string delimiter" -msgstr "evrensel karakter %.*s bir belirteç içinde geçerli değil" +msgstr "ham dizge ayracında geçersiz karakter '%c'" #: lex.c:1525 lex.c:1547 -#, fuzzy -#| msgid "unterminated #%s" msgid "unterminated raw string" -msgstr "sonlandırılmamış #%s" +msgstr "bitirilmemiş ham dizge" #: lex.c:1573 lex.c:1706 msgid "invalid suffix on literal; C++11 requires a space between literal and identifier" -msgstr "" +msgstr "geçersiz ifade soneki; C++11 ifade ve tanımlayıcı arasında bir boşluk gerektirir" #: lex.c:1684 msgid "null character(s) preserved in literal" @@ -785,7 +760,7 @@ msgstr "tarih ve saat saptanamadı" #: macro.c:377 msgid "__COUNTER__ expanded inside directive with -fdirectives-only" -msgstr "" +msgstr "__COUNTER__ -fdirectives-only ile talimat içerisinde genişletildi" #: macro.c:535 msgid "invalid string literal, ignoring final '\\'" @@ -823,7 +798,7 @@ msgstr "işlev benzeri makro \"%s\" geleneksel C'de argümanlarla kullanılmalı #: macro.c:1746 #, c-format msgid "invoking macro %s argument %d: empty macro arguments are undefined in ISO C90 and ISO C++98" -msgstr "" +msgstr "%s makrosu %d argümanı uygulanıyor: ISO C90 ve ISO C++98 içerisinde boş makro argümanları tanımsızdır" #: macro.c:2708 #, c-format @@ -890,38 +865,36 @@ msgstr "makro argümanı \"%s\" geleneksel C'de dizgelenmiş olmalıydı" msgid "invalid hash type %d in cpp_macro_definition" msgstr "cpp_macro_definition içindeki isimli yapı türü %d geçersiz" -#: pch.c:87 pch.c:335 pch.c:347 pch.c:365 pch.c:371 pch.c:380 pch.c:387 +#: pch.c:87 pch.c:345 pch.c:359 pch.c:377 pch.c:383 pch.c:392 pch.c:399 msgid "while writing precompiled header" msgstr "önderlemeli başlık yazılırken" -#: pch.c:607 -#, fuzzy, c-format -#| msgid "%s: not used because `%s' is defined" +#: pch.c:619 +#, c-format msgid "%s: not used because `%.*s' is poisoned" -msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" +msgstr "%s: `%.*s' zehirli olduğu için kullanılmadı" -#: pch.c:629 +#: pch.c:641 #, c-format msgid "%s: not used because `%.*s' not defined" msgstr "%s: `%.*s' tanımlı olmadığından kullanılmadı" -#: pch.c:641 +#: pch.c:653 #, c-format msgid "%s: not used because `%.*s' defined as `%s' not `%.*s'" msgstr "%s: `%.*s' kullanılmadı çünkü `%s' olarak tanımlı, `%.*s' değil" -#: pch.c:682 +#: pch.c:694 #, c-format msgid "%s: not used because `%s' is defined" msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" -#: pch.c:702 -#, fuzzy, c-format -#| msgid "%s: not used because `%s' is defined" +#: pch.c:714 +#, c-format msgid "%s: not used because `__COUNTER__' is invalid" -msgstr "%s: `%s' tanımlı olduğundan kullanılmadı" +msgstr "%s: `__COUNTER__' geçersiz olduğundan kullanılmadı" -#: pch.c:711 pch.c:886 +#: pch.c:723 pch.c:898 msgid "while reading precompiled header" msgstr "önderlemeli başlık okunurken" -- cgit v1.2.3 From be3a22c839293ea6c2b284dee1aa931daf84a14b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 2 Nov 2013 00:16:52 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204307 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index bbd1ee0457b..aca91ede468 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131101 +20131102 -- cgit v1.2.3 From 4e5021b46606355d4d742b502ed358d6ee17e766 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sat, 2 Nov 2013 12:52:04 +0000 Subject: 2013-11-02 Janus Weil Backport from mainline 2013-09-23 Janus Weil PR fortran/58355 * decl.c (check_extended_derived_type): Prevent segfault, modify error message. 2013-11-02 Janus Weil Backport from mainline 2013-09-23 Janus Weil PR fortran/58355 * gfortran.dg/extends_15.f90: New. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204318 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/decl.c | 8 +++++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gfortran.dg/extends_15.f90 | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/extends_15.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c8733a6d77e..dd66a8350bf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2013-11-02 Janus Weil + + Backport from mainline + 2013-09-23 Janus Weil + + PR fortran/58355 + * decl.c (check_extended_derived_type): Prevent segfault, modify error + message. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 72c511c8b24..b748cfd9561 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -7384,6 +7384,7 @@ syntax: /* Check a derived type that is being extended. */ + static gfc_symbol* check_extended_derived_type (char *name) { @@ -7395,14 +7396,15 @@ check_extended_derived_type (char *name) return NULL; } + extended = gfc_find_dt_in_generic (extended); + + /* F08:C428. */ if (!extended) { - gfc_error ("No such symbol in TYPE definition at %C"); + gfc_error ("Symbol '%s' at %C has not been previously defined", name); return NULL; } - extended = gfc_find_dt_in_generic (extended); - if (extended->attr.flavor != FL_DERIVED) { gfc_error ("'%s' in EXTENDS expression at %C is not a " diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c958c945be..665355b308d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-11-02 Janus Weil + + Backport from mainline + 2013-09-23 Janus Weil + + PR fortran/58355 + * gfortran.dg/extends_15.f90: New. + 2013-10-29 Uros Bizjak Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/extends_15.f90 b/gcc/testsuite/gfortran.dg/extends_15.f90 new file mode 100644 index 00000000000..06c31799a00 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/extends_15.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR 58355: [4.7/4.8/4.9 Regression] [F03] ICE with TYPE, EXTENDS before parent TYPE defined +! +! Contributed by Andrew Benson + +module ct + public :: t1 + + type, extends(t1) :: t2 ! { dg-error "has not been previously defined" } + + type :: t1 + end type +end + +! { dg-final { cleanup-modules "ct" } } -- cgit v1.2.3 From f57663304b5726a3062e8cc3739d1c3eebb2f19c Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 3 Nov 2013 00:17:06 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204323 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index aca91ede468..edd9960d31a 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131102 +20131103 -- cgit v1.2.3 From ede0990ba02438be095d0ebff7f1edcf4255c993 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sun, 3 Nov 2013 22:22:22 +0000 Subject: Truncate x32 DImode TLS address to a SImode register gcc/ Backport from mainline 2013-10-12 H.J. Lu PR target/58690 * config/i386/i386.c (ix86_copy_addr_to_reg): New function. (ix86_expand_movmem): Replace copy_addr_to_reg with ix86_copy_addr_to_reg. (ix86_expand_setmem): Likewise. gcc/testsuite/ Backport from mainline 2013-10-12 H.J. Lu PR target/58690 * gcc.target/i386/pr58690.c: New test git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204338 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++++ gcc/config/i386/i386.c | 21 ++++++++++++++++++--- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.target/i386/pr58690.c | 14 ++++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr58690.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d98f528d1ec..a6884f4fd70 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2013-11-03 H.J. Lu + + Backport from mainline + 2013-10-12 H.J. Lu + + PR target/58690 + * config/i386/i386.c (ix86_copy_addr_to_reg): New function. + (ix86_expand_movmem): Replace copy_addr_to_reg with + ix86_copy_addr_to_reg. + (ix86_expand_setmem): Likewise. + 2013-10-29 Uros Bizjak Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index dca8d4ef9ff..65b2767ba52 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -21745,6 +21745,21 @@ counter_mode (rtx count_exp) return SImode; } +/* Copy the address to a Pmode register. This is used for x32 to + truncate DImode TLS address to a SImode register. */ + +static rtx +ix86_copy_addr_to_reg (rtx addr) +{ + if (GET_MODE (addr) == Pmode) + return copy_addr_to_reg (addr); + else + { + gcc_assert (GET_MODE (addr) == DImode && Pmode == SImode); + return gen_rtx_SUBREG (SImode, copy_to_mode_reg (DImode, addr), 0); + } +} + /* When SRCPTR is non-NULL, output simple loop to move memory pointer to SRCPTR to DESTPTR via chunks of MODE unrolled UNROLL times, overall size is COUNT specified in bytes. When SRCPTR is NULL, output the @@ -22733,8 +22748,8 @@ ix86_expand_movmem (rtx dst, rtx src, rtx count_exp, rtx align_exp, gcc_assert (alg != no_stringop); if (!count) count_exp = copy_to_mode_reg (GET_MODE (count_exp), count_exp); - destreg = copy_addr_to_reg (XEXP (dst, 0)); - srcreg = copy_addr_to_reg (XEXP (src, 0)); + destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); + srcreg = ix86_copy_addr_to_reg (XEXP (src, 0)); switch (alg) { case libcall: @@ -23124,7 +23139,7 @@ ix86_expand_setmem (rtx dst, rtx count_exp, rtx val_exp, rtx align_exp, gcc_assert (alg != no_stringop); if (!count) count_exp = copy_to_mode_reg (counter_mode (count_exp), count_exp); - destreg = copy_addr_to_reg (XEXP (dst, 0)); + destreg = ix86_copy_addr_to_reg (XEXP (dst, 0)); switch (alg) { case libcall: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 665355b308d..c479d93286a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-11-03 H.J. Lu + + Backport from mainline + 2013-10-12 H.J. Lu + + PR target/58690 + * gcc.target/i386/pr58690.c: New test + 2013-11-02 Janus Weil Backport from mainline diff --git a/gcc/testsuite/gcc.target/i386/pr58690.c b/gcc/testsuite/gcc.target/i386/pr58690.c new file mode 100644 index 00000000000..87a87cc9c90 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr58690.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { ! { ia32 } } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O2 -mx32 -maddress-mode=short" } */ + +struct gomp_thread +{ + char foo[41]; +}; +extern __thread struct gomp_thread gomp_tls_data; +void +foo (void) +{ + __builtin_memset (&gomp_tls_data, '\0', sizeof (gomp_tls_data)); +} -- cgit v1.2.3 From 51bc6bf9cbb4ed32f50d93f27e566b68ef08c150 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 4 Nov 2013 00:16:54 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204341 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index edd9960d31a..6e5286a0dd2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131103 +20131104 -- cgit v1.2.3 From f294224881015b2602a6a2d0a85d7ae0061b197a Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 4 Nov 2013 16:21:34 +0000 Subject: PR c++/58979 c-family/ * c-common.c (invalid_indirection_error): Handle RO_ARROW_STAR case. testsuite/ * g++.dg/diagnostic/pr58979.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204354 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 8 ++++++++ gcc/c-family/c-common.c | 5 +++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/diagnostic/pr58979.C | 4 ++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/diagnostic/pr58979.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 794be14c412..f2d18bcc4a2 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2013-11-04 Marek Polacek + + Backport from mainline + 2013-11-04 Marek Polacek + + PR c++/58979 + * c-common.c (invalid_indirection_error): Handle RO_ARROW_STAR case. + 2013-10-16 Release Manager * GCC 4.8.2 released. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 0d91cc3cfdf..471572081e7 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -9763,6 +9763,11 @@ invalid_indirection_error (location_t loc, tree type, ref_operator errstring) "invalid type argument of %<->%> (have %qT)", type); break; + case RO_ARROW_STAR: + error_at (loc, + "invalid type argument of %<->*%> (have %qT)", + type); + break; case RO_IMPLICIT_CONVERSION: error_at (loc, "invalid type argument of implicit conversion (have %qT)", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c479d93286a..2660c5ad215 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-11-04 Marek Polacek + + Backport from mainline + 2013-11-04 Marek Polacek + + PR c++/58979 + * g++.dg/diagnostic/pr58979.C: New test. + 2013-11-03 H.J. Lu Backport from mainline diff --git a/gcc/testsuite/g++.dg/diagnostic/pr58979.C b/gcc/testsuite/g++.dg/diagnostic/pr58979.C new file mode 100644 index 00000000000..6be3f143693 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr58979.C @@ -0,0 +1,4 @@ +// PR c++/58979 +// { dg-do compile } + +int i = 0->*0; // { dg-error "invalid type argument of" } -- cgit v1.2.3 From f765310885efb2cb0d1582cf9f8ecfb96f2b3f4e Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Tue, 5 Nov 2013 00:16:22 +0000 Subject: Daily bump. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204374 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6e5286a0dd2..8ef6dd16bf9 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20131104 +20131105 -- cgit v1.2.3 From 862b7fb7b54089280ecdd4b52fe8758f6ea0e338 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 5 Nov 2013 12:11:17 +0000 Subject: PR tree-optimization/58984 * ipa-prop.c (ipa_load_from_parm_agg_1): Add SIZE_P argument, set *SIZE_P if non-NULL on success. (ipa_load_from_parm_agg, ipa_analyze_indirect_call_uses): Adjust callers. (ipcp_transform_function): Likewise. Punt if size of access is different from TYPE_SIZE on v->value's type. * gcc.c-torture/execute/pr58984.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204387 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 +++++ gcc/ipa-prop.c | 18 ++++++--- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.c-torture/execute/pr58984.c | 57 +++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr58984.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6884f4fd70..4766a4a8f43 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-11-05 Jakub Jelinek + + PR tree-optimization/58984 + * ipa-prop.c (ipa_load_from_parm_agg_1): Add SIZE_P argument, + set *SIZE_P if non-NULL on success. + (ipa_load_from_parm_agg, ipa_analyze_indirect_call_uses): Adjust + callers. + (ipcp_transform_function): Likewise. Punt if size of access + is different from TYPE_SIZE on v->value's type. + 2013-11-03 H.J. Lu Backport from mainline diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 33e8d4d2115..47d487d158e 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -740,7 +740,7 @@ static bool ipa_load_from_parm_agg_1 (vec descriptors, struct param_analysis_info *parms_ainfo, gimple stmt, tree op, int *index_p, HOST_WIDE_INT *offset_p, - bool *by_ref_p) + HOST_WIDE_INT *size_p, bool *by_ref_p) { int index; HOST_WIDE_INT size, max_size; @@ -758,6 +758,8 @@ ipa_load_from_parm_agg_1 (vec descriptors, { *index_p = index; *by_ref_p = false; + if (size_p) + *size_p = size; return true; } return false; @@ -800,6 +802,8 @@ ipa_load_from_parm_agg_1 (vec descriptors, { *index_p = index; *by_ref_p = true; + if (size_p) + *size_p = size; return true; } return false; @@ -814,7 +818,7 @@ ipa_load_from_parm_agg (struct ipa_node_params *info, gimple stmt, bool *by_ref_p) { return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p, - offset_p, by_ref_p); + offset_p, NULL, by_ref_p); } /* Given that an actual argument is an SSA_NAME (given in NAME) and is a result @@ -1646,7 +1650,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node, if (gimple_assign_single_p (def) && ipa_load_from_parm_agg_1 (info->descriptors, parms_ainfo, def, gimple_assign_rhs1 (def), &index, &offset, - &by_ref)) + NULL, &by_ref)) { struct cgraph_edge *cs = ipa_note_param_call (node, index, call); cs->indirect_info->offset = offset; @@ -3877,7 +3881,7 @@ ipcp_transform_function (struct cgraph_node *node) struct ipa_agg_replacement_value *v; gimple stmt = gsi_stmt (gsi); tree rhs, val, t; - HOST_WIDE_INT offset; + HOST_WIDE_INT offset, size; int index; bool by_ref, vce; @@ -3904,13 +3908,15 @@ ipcp_transform_function (struct cgraph_node *node) continue; if (!ipa_load_from_parm_agg_1 (descriptors, parms_ainfo, stmt, - rhs, &index, &offset, &by_ref)) + rhs, &index, &offset, &size, &by_ref)) continue; for (v = aggval; v; v = v->next) if (v->index == index && v->offset == offset) break; - if (!v || v->by_ref != by_ref) + if (!v + || v->by_ref != by_ref + || tree_low_cst (TYPE_SIZE (TREE_TYPE (v->value)), 0) != size) continue; gcc_checking_assert (is_gimple_ip_invariant (v->value)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2660c5ad215..db952335633 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-11-05 Jakub Jelinek + + PR tree-optimization/58984 + * gcc.c-torture/execute/pr58984.c: New test. + 2013-11-04 Marek Polacek Backport from mainline diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58984.c b/gcc/testsuite/gcc.c-torture/execute/pr58984.c new file mode 100644 index 00000000000..e0f7669c78d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr58984.c @@ -0,0 +1,57 @@ +/* PR tree-optimization/58984 */ + +struct S { int f0 : 8; int : 6; int f1 : 5; }; +struct T { char f0; int : 6; int f1 : 5; }; + +int a, *c = &a, e, n, b, m; + +static int +foo (struct S p) +{ + const unsigned short *f[36]; + for (; e < 2; e++) + { + const unsigned short **i = &f[0]; + *c ^= 1; + if (p.f1) + { + *i = 0; + return b; + } + } + return 0; +} + +static int +bar (struct T p) +{ + const unsigned short *f[36]; + for (; e < 2; e++) + { + const unsigned short **i = &f[0]; + *c ^= 1; + if (p.f1) + { + *i = 0; + return b; + } + } + return 0; +} + +int +main () +{ + struct S o = { 1, 1 }; + foo (o); + m = n || o.f0; + if (a != 1) + __builtin_abort (); + e = 0; + struct T p = { 1, 1 }; + bar (p); + m |= n || p.f0; + if (a != 0) + __builtin_abort (); + return 0; +} -- cgit v1.2.3 From 9322181e9915839206445777efa247132b73b8b3 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 5 Nov 2013 18:50:44 +0000 Subject: * config/i386/t-rtems (MULTILIB_MATCHES): Fix option typos. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204409 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/t-rtems | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4766a4a8f43..b844c16eb87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2013-11-05 Uros Bizjak + + * config/i386/t-rtems (MULTILIB_MATCHES): Fix option typos. + 2013-11-05 Jakub Jelinek PR tree-optimization/58984 diff --git a/gcc/config/i386/t-rtems b/gcc/config/i386/t-rtems index 6161ec10090..fef4c22e9c1 100644 --- a/gcc/config/i386/t-rtems +++ b/gcc/config/i386/t-rtems @@ -17,11 +17,10 @@ # . # -MULTILIB_OPTIONS = mtune=i486/mtune=pentium/mtune=pentiumpro \ -msoft-float +MULTILIB_OPTIONS = mtune=i486/mtune=pentium/mtune=pentiumpro msoft-float MULTILIB_DIRNAMES= m486 mpentium mpentiumpro soft-float -MULTILIB_MATCHES = msoft-float=mno-m80387 -MULTILIB_MATCHES += mtune?pentium=mtune?k6 mtune?pentiumpro=mtune?mathlon +MULTILIB_MATCHES = msoft-float=mno-80387 +MULTILIB_MATCHES += mtune?pentium=mtune?k6 mtune?pentiumpro=mtune?athlon MULTILIB_EXCEPTIONS = \ mtune=pentium/*msoft-float* \ mtune=pentiumpro/*msoft-float* -- cgit v1.2.3 From 14406dd4ac8f168d66b922af89ba75ba713794a3 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 5 Nov 2013 19:59:32 +0000 Subject: * doc/xml/manual/status_cxx2011.xml: Document aligned_union as missing. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204418 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 5 +++++ libstdc++-v3/doc/xml/manual/status_cxx2011.xml | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3fb5d882a46..755475a97b6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2013-11-05 Jonathan Wakely + + * doc/xml/manual/status_cxx2011.xml: Document aligned_union as + missing. + 2013-11-01 Paolo Carlini PR libstdc++/58952 diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml index 5693bfd77c5..8b781c0695f 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml @@ -877,10 +877,11 @@ particular release. + 20.9.7.6 Other transformations - Y - + Partial + Missing aligned_union. 20.10 -- cgit v1.2.3 From 5fc12bd9c603fc7d4120a9ef0f7b5caf0a47f9a4 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 5 Nov 2013 21:23:44 +0000 Subject: * doc/xml/manual/spine.xml: Update copyright years. * doc/html/*: Regenerate. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204422 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 3 + libstdc++-v3/doc/html/api.html | 4 +- libstdc++-v3/doc/html/bk02.html | 2 +- libstdc++-v3/doc/html/bk03.html | 2 +- libstdc++-v3/doc/html/faq.html | 4 +- libstdc++-v3/doc/html/index.html | 8 +-- libstdc++-v3/doc/html/manual/abi.html | 18 +++--- libstdc++-v3/doc/html/manual/algorithms.html | 6 +- libstdc++-v3/doc/html/manual/api.html | 6 +- libstdc++-v3/doc/html/manual/appendix.html | 4 +- .../doc/html/manual/appendix_contributing.html | 8 +-- libstdc++-v3/doc/html/manual/appendix_free.html | 4 +- libstdc++-v3/doc/html/manual/appendix_gfdl.html | 2 +- libstdc++-v3/doc/html/manual/appendix_gpl.html | 6 +- libstdc++-v3/doc/html/manual/appendix_porting.html | 8 +-- libstdc++-v3/doc/html/manual/associative.html | 2 +- libstdc++-v3/doc/html/manual/atomics.html | 6 +- libstdc++-v3/doc/html/manual/backwards.html | 8 +-- libstdc++-v3/doc/html/manual/bitmap_allocator.html | 4 +- .../doc/html/manual/bitmap_allocator_impl.html | 4 +- libstdc++-v3/doc/html/manual/bugs.html | 2 +- libstdc++-v3/doc/html/manual/concept_checking.html | 2 +- libstdc++-v3/doc/html/manual/concurrency.html | 6 +- libstdc++-v3/doc/html/manual/configure.html | 2 +- libstdc++-v3/doc/html/manual/containers.html | 6 +- libstdc++-v3/doc/html/manual/containers_and_c.html | 2 +- libstdc++-v3/doc/html/manual/debug.html | 4 +- libstdc++-v3/doc/html/manual/debug_mode.html | 4 +- .../doc/html/manual/debug_mode_design.html | 4 +- .../doc/html/manual/debug_mode_semantics.html | 2 +- libstdc++-v3/doc/html/manual/debug_mode_using.html | 6 +- libstdc++-v3/doc/html/manual/diagnostics.html | 6 +- .../doc/html/manual/documentation_hacking.html | 15 +++-- libstdc++-v3/doc/html/manual/dynamic_memory.html | 2 +- libstdc++-v3/doc/html/manual/ext_algorithms.html | 2 +- .../doc/html/manual/ext_compile_checks.html | 2 +- libstdc++-v3/doc/html/manual/ext_concurrency.html | 4 +- .../doc/html/manual/ext_concurrency_impl.html | 2 +- .../doc/html/manual/ext_concurrency_use.html | 2 +- libstdc++-v3/doc/html/manual/ext_containers.html | 4 +- libstdc++-v3/doc/html/manual/ext_demangling.html | 2 +- libstdc++-v3/doc/html/manual/ext_io.html | 4 +- libstdc++-v3/doc/html/manual/ext_iterators.html | 2 +- libstdc++-v3/doc/html/manual/ext_numerics.html | 2 +- libstdc++-v3/doc/html/manual/ext_preface.html | 4 +- libstdc++-v3/doc/html/manual/ext_sgi.html | 2 +- libstdc++-v3/doc/html/manual/ext_utilities.html | 2 +- libstdc++-v3/doc/html/manual/extensions.html | 6 +- libstdc++-v3/doc/html/manual/facets.html | 58 +++++++++--------- libstdc++-v3/doc/html/manual/fstreams.html | 2 +- .../manual/generalized_numeric_operations.html | 2 +- libstdc++-v3/doc/html/manual/index.html | 24 ++++---- libstdc++-v3/doc/html/manual/internals.html | 2 +- libstdc++-v3/doc/html/manual/intro.html | 6 +- libstdc++-v3/doc/html/manual/io.html | 6 +- libstdc++-v3/doc/html/manual/io_and_c.html | 2 +- libstdc++-v3/doc/html/manual/iterators.html | 6 +- libstdc++-v3/doc/html/manual/license.html | 2 +- libstdc++-v3/doc/html/manual/localization.html | 20 +++---- libstdc++-v3/doc/html/manual/make.html | 2 +- libstdc++-v3/doc/html/manual/memory.html | 46 +++++++-------- libstdc++-v3/doc/html/manual/mt_allocator.html | 4 +- .../doc/html/manual/mt_allocator_design.html | 2 +- .../doc/html/manual/mt_allocator_ex_multi.html | 2 +- .../doc/html/manual/mt_allocator_ex_single.html | 2 +- .../doc/html/manual/mt_allocator_impl.html | 2 +- libstdc++-v3/doc/html/manual/numerics.html | 6 +- libstdc++-v3/doc/html/manual/numerics_and_c.html | 2 +- libstdc++-v3/doc/html/manual/pairs.html | 2 +- libstdc++-v3/doc/html/manual/parallel_mode.html | 8 +-- .../doc/html/manual/parallel_mode_design.html | 2 +- .../doc/html/manual/parallel_mode_semantics.html | 2 +- .../doc/html/manual/parallel_mode_test.html | 2 +- .../doc/html/manual/parallel_mode_using.html | 4 +- .../manual/policy_based_data_structures_test.html | 2 +- .../doc/html/manual/policy_data_structures.html | 20 +++---- .../html/manual/policy_data_structures_ack.html | 5 +- .../html/manual/policy_data_structures_design.html | 68 +++++++++++----------- .../html/manual/policy_data_structures_using.html | 4 +- libstdc++-v3/doc/html/manual/profile_mode.html | 6 +- libstdc++-v3/doc/html/manual/profile_mode_api.html | 2 +- .../doc/html/manual/profile_mode_cost_model.html | 2 +- .../doc/html/manual/profile_mode_design.html | 4 +- .../doc/html/manual/profile_mode_devel.html | 2 +- .../doc/html/manual/profile_mode_diagnostics.html | 8 +-- .../doc/html/manual/profile_mode_impl.html | 2 +- libstdc++-v3/doc/html/manual/setup.html | 4 +- .../doc/html/manual/source_code_style.html | 2 +- .../doc/html/manual/source_design_notes.html | 2 +- .../doc/html/manual/source_organization.html | 2 +- libstdc++-v3/doc/html/manual/status.html | 14 ++--- libstdc++-v3/doc/html/manual/std_contents.html | 8 +-- libstdc++-v3/doc/html/manual/streambufs.html | 2 +- libstdc++-v3/doc/html/manual/strings.html | 6 +- libstdc++-v3/doc/html/manual/stringstreams.html | 2 +- libstdc++-v3/doc/html/manual/support.html | 6 +- libstdc++-v3/doc/html/manual/termination.html | 2 +- libstdc++-v3/doc/html/manual/test.html | 4 +- libstdc++-v3/doc/html/manual/traits.html | 2 +- .../doc/html/manual/unordered_associative.html | 2 +- libstdc++-v3/doc/html/manual/using.html | 6 +- .../doc/html/manual/using_concurrency.html | 2 +- .../doc/html/manual/using_dynamic_or_shared.html | 2 +- libstdc++-v3/doc/html/manual/using_exceptions.html | 18 +++--- libstdc++-v3/doc/html/manual/using_headers.html | 14 ++--- libstdc++-v3/doc/html/manual/using_macros.html | 2 +- libstdc++-v3/doc/html/manual/using_namespaces.html | 2 +- libstdc++-v3/doc/html/manual/utilities.html | 6 +- libstdc++-v3/doc/xml/manual/spine.xml | 1 + 109 files changed, 334 insertions(+), 332 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 755475a97b6..f2e38052a41 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -3,6 +3,9 @@ * doc/xml/manual/status_cxx2011.xml: Document aligned_union as missing. + * doc/xml/manual/spine.xml: Update copyright years. + * doc/html/*: Regenerate. + 2013-11-01 Paolo Carlini PR libstdc++/58952 diff --git a/libstdc++-v3/doc/html/api.html b/libstdc++-v3/doc/html/api.html index cc338d23eeb..fb51abc7f12 100644 --- a/libstdc++-v3/doc/html/api.html +++ b/libstdc++-v3/doc/html/api.html @@ -1,12 +1,12 @@ -The GNU C++ Library API Reference

The GNU C++ Library API Reference

The GNU C++ Library API Reference


diff --git a/libstdc++-v3/doc/html/bk02.html b/libstdc++-v3/doc/html/bk02.html index df887b8b3b7..4529fb8a230 100644 --- a/libstdc++-v3/doc/html/bk02.html +++ b/libstdc++-v3/doc/html/bk02.html @@ -1,2 +1,2 @@ -

\ No newline at end of file + \ No newline at end of file diff --git a/libstdc++-v3/doc/html/bk03.html b/libstdc++-v3/doc/html/bk03.html index 316d2cd7bb2..072e7faa59f 100644 --- a/libstdc++-v3/doc/html/bk03.html +++ b/libstdc++-v3/doc/html/bk03.html @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libstdc++-v3/doc/html/faq.html b/libstdc++-v3/doc/html/faq.html index b90c93f9e5b..95aad668c2f 100644 --- a/libstdc++-v3/doc/html/faq.html +++ b/libstdc++-v3/doc/html/faq.html @@ -1,9 +1,9 @@ -Frequently Asked Questions

Frequently Asked Questions

Frequently Asked Questions


1.1. +


1.1. What is libstdc++?
1.2. Why should I use libstdc++? diff --git a/libstdc++-v3/doc/html/index.html b/libstdc++-v3/doc/html/index.html index 7481dc9d04d..787112d9299 100644 --- a/libstdc++-v3/doc/html/index.html +++ b/libstdc++-v3/doc/html/index.html @@ -1,5 +1,5 @@ -The GNU C++ Library

The GNU C++ Library

Short Contents

+The GNU C++ Library

The GNU C++ Library

Short Contents

Copyright (C) 2008-2013 FSF @@ -20,7 +20,7 @@

  • API and Source Documentation

  • -



    Table of Contents

    The GNU C++ Library Manual
    I. Introduction
    1. Status
    Implementation Status
    C++ 1998/2003
    Implementation Status
    Implementation Specific Behavior
    C++ 2011
    Implementation Specific Behavior
    C++ TR1
    Implementation Specific Behavior
    C++ TR 24733
    License
    The Code: GPL
    The Documentation: GPL, FDL
    Bugs
    Implementation Bugs
    Standard Bugs
    2. Setup
    Prerequisites
    Configure
    Make
    3. Using
    Command Options
    Headers
    Header Files
    Mixing Headers
    The C Headers and namespace std
    Precompiled Headers
    Macros
    Namespaces
    Available Namespaces
    namespace std
    Using Namespace Composition
    Linking
    Almost Nothing
    Finding Dynamic or Shared Libraries
    Concurrency
    Prerequisites
    Thread Safety
    Atomics
    IO
    Structure
    Defaults
    Future
    Alternatives
    Containers
    Exceptions
    Exception Safety
    Exception Neutrality
    Doing without
    Compatibility
    With C
    With POSIX thread cancellation
    Debugging Support
    Using g++
    Debug Versions of Library Binary Files
    Memory Leak Hunting
    Data Race Hunting
    Using gdb
    Tracking uncaught exceptions
    Debug Mode
    Compile Time Checking
    Profile-based Performance Analysis
    II. @@ -34,13 +34,13 @@
    Exceptions
    API Reference
    Adding Data to exception
    Concept Checking
    6. Utilities -
    Functors
    Pairs
    Memory
    Allocators
    Requirements
    Design Issues
    Implementation
    Interface Design
    Selecting Default Allocation Policy
    Disabling Memory Caching
    Using a Specific Allocator
    Custom Allocators
    Extension Allocators
    auto_ptr
    Limitations
    Use in Containers
    shared_ptr
    Requirements
    Design Issues
    Implementation
    Class Hierarchy
    Thread Safety
    Selecting Lock Policy
    Related functions and classes
    Use
    Examples
    Unresolved Issues
    Acknowledgments
    Traits
    7. +
    Functors
    Pairs
    Memory
    Allocators
    Requirements
    Design Issues
    Implementation
    Interface Design
    Selecting Default Allocation Policy
    Disabling Memory Caching
    Using a Specific Allocator
    Custom Allocators
    Extension Allocators
    auto_ptr
    Limitations
    Use in Containers
    shared_ptr
    Requirements
    Design Issues
    Implementation
    Class Hierarchy
    Thread Safety
    Selecting Lock Policy
    Related functions and classes
    Use
    Examples
    Unresolved Issues
    Acknowledgments
    Traits
    7. Strings
    String Classes
    Simple Transformations
    Case Sensitivity
    Arbitrary Character Types
    Tokenizing
    Shrink to Fit
    CString (MFC)
    8. Localization -
    Locales
    locale
    Requirements
    Design
    Implementation
    Interacting with "C" locales
    Future
    Facets
    ctype
    Implementation
    Specializations
    Future
    codecvt
    Requirements
    Design
    wchar_t Size
    Support for Unicode
    Other Issues
    Implementation
    Use
    Future
    messages
    Requirements
    Design
    Implementation
    Models
    The GNU Model
    Use
    Future
    9. +
    Locales
    locale
    Requirements
    Design
    Implementation
    Interacting with "C" locales
    Future
    Facets
    ctype
    Implementation
    Specializations
    Future
    codecvt
    Requirements
    Design
    wchar_t Size
    Support for Unicode
    Other Issues
    Implementation
    Use
    Future
    messages
    Requirements
    Design
    Implementation
    Models
    The GNU Model
    Use
    Future
    9. Containers
    Sequences
    list
    list::size() is O(n)
    vector
    Space Overhead Management
    Associative
    Insertion Hints
    bitset
    Size Variable
    Type String
    Unordered Associative
    Hash Code
    Hash Code Caching Policy
    Interacting with C
    Containers vs. Arrays
    10. diff --git a/libstdc++-v3/doc/html/manual/abi.html b/libstdc++-v3/doc/html/manual/abi.html index c5cf1edbb4b..337cf81fe0f 100644 --- a/libstdc++-v3/doc/html/manual/abi.html +++ b/libstdc++-v3/doc/html/manual/abi.html @@ -1,5 +1,5 @@ -ABI Policy and Guidelines