From 00fd062886928ee3617a171f31c1e4e07f65f38f Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Mon, 17 Dec 2018 22:07:11 +0000 Subject: [PATCH] re PR target/87870 (ppc64le generates poor code when loading constants into TImode vars) gcc/ PR target/87870 * config/rs6000/vsx.md (nW): New mode iterator. (vsx_mov_64bit): Use it. Remove redundant GPR 0/-1 alternative. Update length attribute for (, ) alternative. (vsx_mov_32bit): Likewise. gcc/testsuite/ PR target/87870 * gcc.target/powerpc/pr87870.c: New test. From-SVN: r267221 --- gcc/ChangeLog | 8 ++++++ gcc/config/rs6000/vsx.md | 32 +++++++++++++++------- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/powerpc/pr87870.c | 28 +++++++++++++++++++ 4 files changed, 63 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr87870.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0f8708f02c0..625429c31c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-12-17 Peter Bergner + + PR target/87870 + * config/rs6000/vsx.md (nW): New mode iterator. + (vsx_mov_64bit): Use it. Remove redundant GPR 0/-1 alternative. + Update length attribute for (, ) alternative. + (vsx_mov_32bit): Likewise. + 2018-12-17 Tom de Vries * config/nvptx/nvptx.c (PTX_VECTOR_LENGTH, PTX_WORKER_LENGTH, diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 52dee7d9f08..65a9892ff9f 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -183,6 +183,18 @@ (TF "??r") (TI "r")]) +;; A mode attribute used for 128-bit constant values. +(define_mode_attr nW [(V16QI "W") + (V8HI "W") + (V4SI "W") + (V4SF "W") + (V2DI "W") + (V2DF "W") + (V1TI "W") + (KF "W") + (TF "W") + (TI "n")]) + ;; Same size integer type for floating point data (define_mode_attr VSi [(V4SF "v4si") (V2DF "v2di") @@ -1193,17 +1205,17 @@ ;; VSX store VSX load VSX move VSX->GPR GPR->VSX LQ (GPR) ;; STQ (GPR) GPR load GPR store GPR move XXSPLTIB VSPLTISW -;; VSX 0/-1 GPR 0/-1 VMX const GPR const LVX (VMX) STVX (VMX) +;; VSX 0/-1 VMX const GPR const LVX (VMX) STVX (VMX) (define_insn "vsx_mov_64bit" [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=ZwO, , , r, we, ?wQ, ?&r, ??r, ??Y, , wo, v, - ?, *r, v, ??r, wZ, v") + ?, v, , wZ, v") (match_operand:VSX_M 1 "input_operand" ", ZwO, , we, r, r, wQ, Y, r, r, wE, jwM, - ?jwM, jwM, W, W, v, wZ"))] + ?jwM, W, , v, wZ"))] "TARGET_POWERPC64 && VECTOR_MEM_VSX_P (mode) && (register_operand (operands[0], mode) @@ -1214,25 +1226,25 @@ [(set_attr "type" "vecstore, vecload, vecsimple, mffgpr, mftgpr, load, store, load, store, *, vecsimple, vecsimple, - vecsimple, *, *, *, vecstore, vecload") + vecsimple, *, *, vecstore, vecload") (set_attr "length" "4, 4, 4, 8, 4, 8, 8, 8, 8, 8, 4, 4, - 4, 8, 20, 20, 4, 4")]) + 4, 20, 8, 4, 4")]) ;; VSX store VSX load VSX move GPR load GPR store GPR move -;; XXSPLTIB VSPLTISW VSX 0/-1 GPR 0/-1 VMX const GPR const +;; XXSPLTIB VSPLTISW VSX 0/-1 VMX const GPR const ;; LVX (VMX) STVX (VMX) (define_insn "*vsx_mov_32bit" [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=ZwO, , , ??r, ??Y, , - wo, v, ?, *r, v, ??r, + wo, v, ?, v, , wZ, v") (match_operand:VSX_M 1 "input_operand" ", ZwO, , Y, r, r, - wE, jwM, ?jwM, jwM, W, W, + wE, jwM, ?jwM, W, , v, wZ"))] "!TARGET_POWERPC64 && VECTOR_MEM_VSX_P (mode) @@ -1243,12 +1255,12 @@ } [(set_attr "type" "vecstore, vecload, vecsimple, load, store, *, - vecsimple, vecsimple, vecsimple, *, *, *, + vecsimple, vecsimple, vecsimple, *, *, vecstore, vecload") (set_attr "length" "4, 4, 4, 16, 16, 16, - 4, 4, 4, 16, 20, 32, + 4, 4, 4, 20, 16, 4, 4")]) ;; Explicit load/store expanders for the builtin functions diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50ff5322a4b..77787b2c8c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-17 Peter Bergner + + PR target/87870 + * gcc.target/powerpc/pr87870.c: New test. + 2018-12-17 Jakub Jelinek PR c++/88410 diff --git a/gcc/testsuite/gcc.target/powerpc/pr87870.c b/gcc/testsuite/gcc.target/powerpc/pr87870.c new file mode 100644 index 00000000000..d2108ac3386 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr87870.c @@ -0,0 +1,28 @@ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ +/* { dg-options "-O2" } */ + +__int128 +test0 (void) +{ + return 0; +} + +__int128 +test1 (void) +{ + return 1; +} + +__int128 +test2 (void) +{ + return -1; +} + +__int128 +test3 (void) +{ + return ((__int128)0xdeadbeefcafebabe << 64) | 0xfacefeedbaaaaaad; +} + +/* { dg-final { scan-assembler-not {\mld\M} } } */ -- 2.30.2