diff mbox series

[2/2] rs6000: Use unspec_volatile for darn (PR91481)

Message ID 9f40f4acef1c0bf44707e9718d69e9fcd5c2adfc.1566482473.git.segher@kernel.crashing.org
State New
Headers show
Series [1/2] rs6000: Move various non-vector things out of altivec.md | expand

Commit Message

Segher Boessenkool Aug. 22, 2019, 7:20 p.m. UTC
Every call to darn should deliver a *new* random number; such calls
shouldnot be CSEd together.  So they should be unspec_volatile, not
plain unspec.

Tested on powerpc64-linux {-m32,-m64}.  (New testcase coming soon).
Committing to trunk, and will backport to 9, 8, 7 as well.


Segher


2019-08-22  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/91481
	* config/rs6000/rs6000.md (unspec): Delete UNSPEC_DARN, UNSPEC_DARN_32,
	and UNSPEC_DARN_RAW.
	(unspecv): New enumerator values UNSPECV_DARN, UNSPECV_DARN_32, and
	UNSPECV_DARN_RAW.
	(darn_32): Use an unspec_volatile, and UNSPECV_DARN_32.
	(darn_raw): Use an unspec_volatile, and UNSPECV_DARN_RAW.
	(darn): Use an unspec_volatile, and UNSPECV_DARN.

---
 gcc/config/rs6000/rs6000.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Segher Boessenkool Aug. 30, 2019, 4:44 p.m. UTC | #1
On Thu, Aug 22, 2019 at 07:20:48PM +0000, Segher Boessenkool wrote:
> Every call to darn should deliver a *new* random number; such calls
> shouldnot be CSEd together.  So they should be unspec_volatile, not
> plain unspec.
> 
> Tested on powerpc64-linux {-m32,-m64}.  (New testcase coming soon).
> Committing to trunk, and will backport to 9, 8, 7 as well.

Done now, all three patches (including the testcase).


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 68cdf68..b0aea23 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -134,9 +134,6 @@  (define_c_enum "unspec"
    UNSPEC_LSQ
    UNSPEC_FUSION_GPR
    UNSPEC_STACK_CHECK
-   UNSPEC_DARN
-   UNSPEC_DARN_32
-   UNSPEC_DARN_RAW
    UNSPEC_CMPRB
    UNSPEC_CMPRB2
    UNSPEC_CMPEQB
@@ -168,6 +165,9 @@  (define_c_enum "unspecv"
    UNSPECV_EH_RR		; eh_reg_restore
    UNSPECV_ISYNC		; isync instruction
    UNSPECV_MFTB			; move from time base
+   UNSPECV_DARN			; darn 1 (deliver a random number)
+   UNSPECV_DARN_32		; darn 2
+   UNSPECV_DARN_RAW		; darn 0
    UNSPECV_NLGR			; non-local goto receiver
    UNSPECV_MFFS			; Move from FPSCR
    UNSPECV_MFFSL		; Move from FPSCR light instruction version
@@ -14387,21 +14387,21 @@  (define_insn "*cmp<mode>_hw"
 
 (define_insn "darn_32"
   [(set (match_operand:SI 0 "register_operand" "=r")
-        (unspec:SI [(const_int 0)] UNSPEC_DARN_32))]
+        (unspec_volatile:SI [(const_int 0)] UNSPECV_DARN_32))]
   "TARGET_P9_MISC"
   "darn %0,0"
   [(set_attr "type" "integer")])
 
 (define_insn "darn_raw"
   [(set (match_operand:DI 0 "register_operand" "=r")
-        (unspec:DI [(const_int 0)] UNSPEC_DARN_RAW))]
+        (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN_RAW))]
   "TARGET_P9_MISC && TARGET_64BIT"
   "darn %0,2"
   [(set_attr "type" "integer")])
 
 (define_insn "darn"
   [(set (match_operand:DI 0 "register_operand" "=r")
-        (unspec:DI [(const_int 0)] UNSPEC_DARN))]
+        (unspec_volatile:DI [(const_int 0)] UNSPECV_DARN))]
   "TARGET_P9_MISC && TARGET_64BIT"
   "darn %0,1"
   [(set_attr "type" "integer")])