Commit 2561451d by Andreas Krebbel

[multiple changes]

2013-11-20  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
	    Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* config/s390/s390.c (s390_canonicalize_comparison): Don't fold
	int comparisons with an out of range condition code.
	(s390_optimize_nonescaping_tx): Skip empty BBs.
	Generate the new tbegin RTX when removing the FPR clobbers (with
	two SETs).
	(s390_expand_tbegin): Fix the retry loop counter.  Copy CC to the
	result before doing the retry calculations.
	(s390_init_builtins): Make tbegin "returns_twice" and tabort
	"noreturn".
	* config/s390/s390.md (UNSPECV_TBEGIN_TDB): New constant used for
	the TDB setting part of an tbegin.
	("tbegin_1", "tbegin_nofloat_1"): Add a set for the TDB.
	("tx_assist"): Set unused argument to an immediate zero instead of
	loading zero into a GPR and pass it as argument.
	* config/s390/htmxlintrin.h (__TM_simple_begin, __TM_begin):
	Remove inline and related attributes.
	(__TM_nesting_depth, __TM_is_user_abort, __TM_is_named_user_abort)
	(__TM_is_illegal, __TM_is_footprint_exceeded)
	(__TM_is_nested_too_deep, __TM_is_conflict): Fix format value
	check.

2013-11-20  Dominik Vogt  <vogt@linux.vnet.ibm.com>

	* gcc.target/s390/htm-1.c: Rename to ...
	* gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c: ... this
	one.
	* gcc.target/s390/htm-xl-intrin-1.c: Rename to ...
	* gcc.target/s390/htm-builtins-compile-3.c: ... this one.
	* gcc.target/s390/htm-builtins-compile-2.c: New testcase.
	* gcc.target/s390/htm-builtins-1.c: New testcase.
	* gcc.target/s390/htm-builtins-2.c: New testcase.
	* gcc.target/s390/s390.exp: Add check for htm machine.

From-SVN: r205099
parent 5d1a0108
2013-11-20 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
Dominik Vogt <vogt@linux.vnet.ibm.com>
* config/s390/s390.c (s390_canonicalize_comparison): Don't fold
int comparisons with an out of range condition code.
(s390_optimize_nonescaping_tx): Skip empty BBs.
Generate the new tbegin RTX when removing the FPR clobbers (with
two SETs).
(s390_expand_tbegin): Fix the retry loop counter. Copy CC to the
result before doing the retry calculations.
(s390_init_builtins): Make tbegin "returns_twice" and tabort
"noreturn".
* config/s390/s390.md (UNSPECV_TBEGIN_TDB): New constant used for
the TDB setting part of an tbegin.
("tbegin_1", "tbegin_nofloat_1"): Add a set for the TDB.
("tx_assist"): Set unused argument to an immediate zero instead of
loading zero into a GPR and pass it as argument.
* config/s390/htmxlintrin.h (__TM_simple_begin, __TM_begin):
Remove inline and related attributes.
(__TM_nesting_depth, __TM_is_user_abort, __TM_is_named_user_abort)
(__TM_is_illegal, __TM_is_footprint_exceeded)
(__TM_is_nested_too_deep, __TM_is_conflict): Fix format value
check.
2013-11-20 Richard Biener <rguenther@suse.de>
PR lto/59035
......@@ -33,13 +33,20 @@ extern "C" {
the IBM XL compiler. For documentation please see the "z/OS XL
C/C++ Programming Guide" publicly available on the web. */
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
/* FIXME: __TM_simple_begin and __TM_begin should be marked
__always_inline__ as well but this currently produces an error
since the tbegin builtins are "returns_twice" and setjmp_call_p
(calls.c) therefore identifies the functions as calling setjmp.
The tree inliner currently refuses to inline functions calling
setjmp. */
long
__TM_simple_begin ()
{
return __builtin_tbegin_nofloat (0);
}
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
long
__TM_begin (void* const tdb)
{
return __builtin_tbegin_nofloat (tdb);
......@@ -78,7 +85,7 @@ __TM_nesting_depth (void* const tdb_ptr)
if (depth != 0)
return depth;
if (tdb->format == 0)
if (tdb->format != 1)
return 0;
return tdb->nesting_depth;
}
......@@ -90,7 +97,7 @@ __TM_is_user_abort (void* const tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
if (tdb->format == 0)
if (tdb->format != 1)
return 0;
return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE);
......@@ -101,7 +108,7 @@ __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)
if (tdb->format != 1)
return 0;
if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
......@@ -117,7 +124,7 @@ __TM_is_illegal (void* const tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
return (tdb->format == 0
return (tdb->format == 1
&& (tdb->abort_code == 4 /* unfiltered program interruption */
|| tdb->abort_code == 11 /* restricted instruction */));
}
......@@ -127,7 +134,7 @@ __TM_is_footprint_exceeded (void* const tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
return (tdb->format == 0
return (tdb->format == 1
&& (tdb->abort_code == 7 /* fetch overflow */
|| tdb->abort_code == 8 /* store overflow */));
}
......@@ -137,7 +144,7 @@ __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 */
return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
}
extern __inline long __attribute__((__gnu_inline__, __always_inline__, __artificial__))
......@@ -145,7 +152,7 @@ __TM_is_conflict (void* const tdb_ptr)
{
struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
return (tdb->format == 0
return (tdb->format == 1
&& (tdb->abort_code == 9 /* fetch conflict */
|| tdb->abort_code == 10 /* store conflict */));
}
......
......@@ -900,7 +900,8 @@ s390_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
{
/* For CCRAWmode put the required cc mask into the second
operand. */
if (GET_MODE (XVECEXP (*op0, 0, 0)) == CCRAWmode)
if (GET_MODE (XVECEXP (*op0, 0, 0)) == CCRAWmode
&& INTVAL (*op1) >= 0 && INTVAL (*op1) <= 3)
*op1 = gen_rtx_CONST_INT (VOIDmode, 1 << (3 - INTVAL (*op1)));
*op0 = XVECEXP (*op0, 0, 0);
*code = new_code;
......@@ -7973,6 +7974,9 @@ s390_optimize_nonescaping_tx (void)
{
bb = BASIC_BLOCK (bb_index);
if (!bb)
continue;
FOR_BB_INSNS (bb, insn)
{
rtx ite, cc, pat, target;
......@@ -8086,7 +8090,10 @@ s390_optimize_nonescaping_tx (void)
if (!result)
return;
PATTERN (tbegin_insn) = XVECEXP (PATTERN (tbegin_insn), 0, 0);
PATTERN (tbegin_insn) = gen_rtx_PARALLEL (VOIDmode,
gen_rtvec (2,
XVECEXP (PATTERN (tbegin_insn), 0, 0),
XVECEXP (PATTERN (tbegin_insn), 0, 1)));
INSN_CODE (tbegin_insn) = -1;
df_insn_rescan (tbegin_insn);
......@@ -9798,6 +9805,7 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
const int CC3 = 1 << 0;
rtx abort_label = gen_label_rtx ();
rtx leave_label = gen_label_rtx ();
rtx retry_plus_two = gen_reg_rtx (SImode);
rtx retry_reg = gen_reg_rtx (SImode);
rtx retry_label = NULL_RTX;
rtx jump;
......@@ -9806,16 +9814,17 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
if (retry != NULL_RTX)
{
emit_move_insn (retry_reg, retry);
emit_insn (gen_addsi3 (retry_plus_two, retry_reg, const2_rtx));
emit_insn (gen_addsi3 (retry_reg, retry_reg, const1_rtx));
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)));
emit_insn (gen_tbegin_1 (gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK), tdb));
else
emit_insn (gen_tbegin_nofloat_1 (tdb,
gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK)));
emit_insn (gen_tbegin_nofloat_1 (gen_rtx_CONST_INT (VOIDmode, TBEGIN_MASK),
tdb));
jump = s390_emit_jump (abort_label,
gen_rtx_NE (VOIDmode,
......@@ -9836,6 +9845,10 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
/* Abort handler code. */
emit_label (abort_label);
emit_move_insn (dest, gen_rtx_UNSPEC (SImode,
gen_rtvec (1, gen_rtx_REG (CCRAWmode,
CC_REGNUM)),
UNSPEC_CC_TO_INT));
if (retry != NULL_RTX)
{
rtx count = gen_reg_rtx (SImode);
......@@ -9847,7 +9860,7 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
add_int_reg_note (jump, REG_BR_PROB, very_unlikely);
/* CC2 - transient failure. Perform retry with ppa. */
emit_move_insn (count, retry);
emit_move_insn (count, retry_plus_two);
emit_insn (gen_subsi3 (count, count, retry_reg));
emit_insn (gen_tx_assist (count));
jump = emit_jump_insn (gen_doloop_si64 (retry_label,
......@@ -9857,10 +9870,6 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
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);
}
......@@ -9899,6 +9908,9 @@ static void
s390_init_builtins (void)
{
tree ftype, uint64_type;
tree returns_twice_attr = tree_cons (get_identifier ("returns_twice"),
NULL, NULL);
tree noreturn_attr = tree_cons (get_identifier ("noreturn"), NULL, NULL);
/* void foo (void) */
ftype = build_function_type_list (void_type_node, NULL_TREE);
......@@ -9909,17 +9921,17 @@ s390_init_builtins (void)
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);
S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, noreturn_attr);
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);
BUILT_IN_MD, NULL, returns_twice_attr);
add_builtin_function ("__builtin_tbegin_nofloat", ftype,
S390_BUILTIN_TBEGIN_NOFLOAT,
BUILT_IN_MD, NULL, NULL_TREE);
BUILT_IN_MD, NULL, returns_twice_attr);
/* int foo (void *, int) */
ftype = build_function_type_list (integer_type_node, ptr_type_node,
......@@ -9927,11 +9939,11 @@ s390_init_builtins (void)
add_builtin_function ("__builtin_tbegin_retry", ftype,
S390_BUILTIN_TBEGIN_RETRY,
BUILT_IN_MD,
NULL, NULL_TREE);
NULL, returns_twice_attr);
add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype,
S390_BUILTIN_TBEGIN_RETRY_NOFLOAT,
BUILT_IN_MD,
NULL, NULL_TREE);
NULL, returns_twice_attr);
/* int foo (void) */
ftype = build_function_type_list (integer_type_node, NULL_TREE);
......
......@@ -155,6 +155,7 @@
; Transactional Execution support
UNSPECV_TBEGIN
UNSPECV_TBEGIN_TDB
UNSPECV_TBEGINC
UNSPECV_TEND
UNSPECV_TABORT
......@@ -9997,9 +9998,10 @@
(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")]
(unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
UNSPECV_TBEGIN))
(set (match_operand:BLK 1 "memory_operand" "=Q")
(unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))
(clobber (reg:DF 16))
(clobber (reg:DF 17))
(clobber (reg:DF 18))
......@@ -10018,18 +10020,19 @@
(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"
"TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
"tbegin\t%1,%x0"
[(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"
(unspec_volatile:CCRAW [(match_operand 0 "const_int_operand" "D")]
UNSPECV_TBEGIN))
(set (match_operand:BLK 1 "memory_operand" "=Q")
(unspec_volatile:BLK [(match_dup 0)] UNSPECV_TBEGIN_TDB))]
"TARGET_HTM && INTVAL (operands[0]) >= 0 && INTVAL (operands[0]) <= 0xffff"
"tbegin\t%1,%x0"
[(set_attr "op_type" "SIL")])
......@@ -10113,15 +10116,12 @@
; Transaction perform processor assist
(define_expand "tx_assist"
[(set (match_dup 1) (const_int 0))
(unspec_volatile [(match_operand:SI 0 "register_operand" "")
(match_dup 1)
[(unspec_volatile [(match_operand:SI 0 "register_operand" "")
(reg:SI GPR0_REGNUM)
(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")
......@@ -10129,5 +10129,5 @@
(match_operand 2 "const_int_operand" "I")]
UNSPECV_PPA)]
"TARGET_HTM && INTVAL (operands[2]) < 16"
"ppa\t%0,%1,1"
"ppa\t%0,%1,%2"
[(set_attr "op_type" "RRF")])
2013-11-20 Dominik Vogt <vogt@linux.vnet.ibm.com>
* gcc.target/s390/htm-1.c: Rename to ...
* gcc/testsuite/gcc.target/s390/htm-builtins-compile-1.c: ... this
one.
* gcc.target/s390/htm-xl-intrin-1.c: Rename to ...
* gcc.target/s390/htm-builtins-compile-3.c: ... this one.
* gcc.target/s390/htm-builtins-compile-2.c: New testcase.
* gcc.target/s390/htm-builtins-1.c: New testcase.
* gcc.target/s390/htm-builtins-2.c: New testcase.
* gcc.target/s390/s390.exp: Add check for htm machine.
2013-11-19 Joshua J Cogliati <jrincayc@yahoo.com>
PR c/53001
......
/* This checks the availability of the low-level builtins introduced
for transactional execution. */
/* { dg-do compile } */
/* { dg-options "-O3 -march=zEC12 -mzarch" } */
#include <stdint.h>
#include <htmintrin.h>
int global = 0;
uint64_t g;
struct __htm_tdb global_tdb;
int
foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t *mem64)
{
int cc;
int n;
cc = __builtin_tbegin (0);
cc = __builtin_tbegin (tdb);
cc = __builtin_tbegin (&global_tdb);
cc = __builtin_tbegin_nofloat (0);
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 (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, 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," 10 } } */
/* This checks the availability of the low-level builtins introduced
for transactional execution. */
/* { dg-do compile } */
/* { dg-options "-O3 -march=zEC12 -mzarch" } */
#include <stdint.h>
#include <htmintrin.h>
int global = 0;
uint64_t g;
struct __htm_tdb global_tdb;
int
foo (struct __htm_tdb* tdb, int reg, int *mem, uint64_t *mem64)
{
int cc;
int n;
__builtin_tbegin ((void *)0);
__builtin_tbegin ((void *)-99999);
__builtin_tbegin ((void *)99999);
while (__builtin_tbegin ((void *)0) != 0)
{
}
cc = __builtin_tbegin ((void *)0x12345678);
cc = __builtin_tbegin (tdb);
cc = __builtin_tbegin (&global_tdb);
cc = __builtin_tbegin ((void *)(long long)(reg + 0x12345678));
cc = __builtin_tbegin ((void *)(long long)(reg));
__builtin_tbegin_nofloat ((void *)0);
__builtin_tbegin_nofloat ((void *)-99999);
__builtin_tbegin_nofloat ((void *)99999);
cc = __builtin_tbegin_nofloat ((void *)0x12345678);
cc = __builtin_tbegin_nofloat (tdb);
cc = __builtin_tbegin_nofloat (&global_tdb);
cc = __builtin_tbegin_nofloat ((void *)(long long)(reg + 0x12345678));
cc = __builtin_tbegin_nofloat ((void *)(long long)(reg));
__builtin_tbegin_retry ((void *)0, 0);
cc = __builtin_tbegin_retry ((void *)0, 1);
cc = __builtin_tbegin_retry ((void *)0, -1);
cc = __builtin_tbegin_retry ((void *)0, 42);
cc = __builtin_tbegin_retry ((void *)0, reg);
cc = __builtin_tbegin_retry ((void *)0, *mem);
cc = __builtin_tbegin_retry ((void *)0, global);
cc = __builtin_tbegin_retry (tdb, 42);
cc = __builtin_tbegin_retry (&global_tdb, 42);
cc = __builtin_tbegin_retry ((void *)0x12345678, global);
cc = __builtin_tbegin_retry (
(void *)(long long) (reg + 0x12345678), global + 1);
cc = __builtin_tbegin_retry (
(void *)(long long)(reg), global - 1);
__builtin_tbegin_retry_nofloat ((void *)0, 0);
cc = __builtin_tbegin_retry_nofloat ((void *)0, 1);
cc = __builtin_tbegin_retry_nofloat ((void *)0, -1);
cc = __builtin_tbegin_retry_nofloat ((void *)0, 42);
cc = __builtin_tbegin_retry_nofloat ((void *)0, reg);
cc = __builtin_tbegin_retry_nofloat ((void *)0, *mem);
cc = __builtin_tbegin_retry_nofloat ((void *)0, global);
cc = __builtin_tbegin_retry_nofloat (tdb, 42);
cc = __builtin_tbegin_retry_nofloat (&global_tdb, 42);
cc = __builtin_tbegin_retry_nofloat ((void *)0x12345678, global);
cc = __builtin_tbegin_retry_nofloat (
(void *)(long long) (reg + 0x12345678), global + 1);
cc = __builtin_tbegin_retry_nofloat (
(void *)(long long)(reg), global - 1);
__builtin_tbeginc ();
__builtin_tx_nesting_depth ();
n = __builtin_tx_nesting_depth ();
__builtin_non_tx_store (mem64, 0);
{
const uint64_t val_var = 0x1122334455667788;
__builtin_non_tx_store (mem64, val_var);
}
__builtin_non_tx_store (mem64, (uint64_t)reg);
__builtin_non_tx_store (mem64, g);
__builtin_non_tx_store ((uint64_t *)0, 0);
__builtin_non_tx_store ((uint64_t *)0x12345678, 0);
__builtin_non_tx_store (&g, 23);
__builtin_non_tx_store (&g, reg);
__builtin_non_tx_store (&g, *mem);
__builtin_non_tx_store (&g, global);
__builtin_tend();
__builtin_tx_assist (0);
__builtin_tx_assist (1);
__builtin_tx_assist (reg);
__builtin_tx_assist (*mem);
__builtin_tx_assist (global);
}
/* The taborts must go into separate function since they are
"noreturn". */
void
tabort1 ()
{
__builtin_tabort (256);
}
void
tabort2 (int reg)
{
__builtin_tabort (reg);
}
void
tabort3 (int reg)
{
/* { dg-final { scan-assembler-times "tabort\t255" 1 } } */
__builtin_tabort (reg + 255);
}
void
tabort4 (int *mem)
{
__builtin_tabort (*mem);
}
void
tabort5 ()
{
__builtin_tabort (global);
}
void
tabort6 (int *mem)
{
/* 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);
}
void
tabort7 ()
{
__builtin_tabort (global + 255);
}
void
tabort8 ()
{
__builtin_tabort (-1);
}
/* Make sure the tdb NULL argument ends up as immediate value in the
instruction. */
/* { dg-final { scan-assembler-times "tbegin\t0," 17 } } */
/* { dg-final { scan-assembler-times "tbegin\t" 41 } } */
/* Check number of occurences of certain instructions. */
/* { dg-final { scan-assembler-times "tbeginc\t" 1 } } */
/* { dg-final { scan-assembler-times "tabort\t" 8 } } */
/* { dg-final { scan-assembler "ppa\t" } } */
/* { dg-do compile } */
/* { dg-options "-O3 -march=zEC12 -mzarch" } */
void must_not_compile1 (void)
{
__builtin_tabort (0); /* { dg-error "Invalid transaction abort code:" } */
}
void must_not_compile2 (void)
{
__builtin_tabort (255); /* { dg-error "Invalid transaction abort code:" } */
}
......@@ -24,6 +24,19 @@ if ![istarget s390*-*-*] then {
# Load support procs.
load_lib gcc-dg.exp
# Return 1 if htm (etnd - extract nesting depth) instructions can be
# compiled.
proc check_effective_target_htm { } {
if { ![check_runtime s390_check_htm [subst {
int main (void)
{
unsigned int nd = 77;
asm (".insn rre,0xb2ec0000,%0,0" : "=d" (nd));
return nd;
}
}]] } { return 0 } else { return 1 }
}
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment