[0/6] Thread pointer built-in functions / [SH] PR 54760

Message ID 1349996110.8747.44.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo Oct. 11, 2012, 10:55 p.m.
On Thu, 2012-10-11 at 23:11 +0800, Chung-Lin Tang wrote:
> This patch set has been committed, thanks to all maintainers who
> reviewed the respective parts.
> Thanks,
> Chung-Lin

This broke the recently added thread pointer built-ins on SH, but I was
prepared for that, so no problem here.  The attached patch is a straight
forward fix.

However, with the patch applied I get an ICE on one of the SH thread
pointer tests:  gcc/testsuite/gcc.target/sh/pr54760-3.c, function

internal compiler error: in expand_insn, at optabs.c:8208
    __builtin_set_thread_pointer (xx[i]);
0x8478872 expand_insn
0x8478872 expand_insn
0x81ded5a expand_builtin_set_thread_pointer
0x81e6b18 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode,
0x82eeaf9 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
0x8216a7b expand_call_stmt
0x8216a7b expand_gimple_stmt_1
0x8216a7b expand_gimple_stmt
0x8218406 expand_gimple_basic_block
0x821a417 gimple_expand_cfg
Please submit a full bug report,

All the other test cases seem to produce code as expected though.
Could you please try out the failing test case mentioned above?
As mentioned in the file gcc/testsuite/gcc.target/sh/pr54760-3.c it
should be moved to C torture tests.

Anyway, regardless of this failure, the attached patch for SH should be
applicable. OK?



	PR target/54760
	* config/sh/sh.c (bdesc): Remove thread pointer built-ins.
	* config/sh/sh.md (get_thread_pointer, set_thread_pointer): 
	Append mode name 'si'.


Kaz Kojima Oct. 12, 2012, 12:18 a.m. | #1
Oleg Endo <oleg.endo@t-online.de> wrote:
> Anyway, regardless of this failure, the attached patch for SH should be
> applicable. OK?




Index: gcc/config/sh/sh.c
--- gcc/config/sh/sh.c	(revision 192378)
+++ gcc/config/sh/sh.c	(working copy)
@@ -11778,12 +11778,6 @@ 
     CODE_FOR_byterev,	"__builtin_sh_media_BYTEREV", SH_BLTIN_2, 0 },
   { shmedia_builtin_p,
     CODE_FOR_prefetch,	"__builtin_sh_media_PREFO", SH_BLTIN_PSSV, 0 },
-  { sh1_builtin_p,
-    CODE_FOR_get_thread_pointer, "__builtin_thread_pointer", SH_BLTIN_VP, 0 },
-  { sh1_builtin_p,
-    CODE_FOR_set_thread_pointer, "__builtin_set_thread_pointer",
-    SH_BLTIN_PV, 0 },
 static void
Index: gcc/config/sh/sh.md
--- gcc/config/sh/sh.md	(revision 192378)
+++ gcc/config/sh/sh.md	(working copy)
@@ -10085,7 +10085,7 @@ 
 ;; On SH the thread pointer is kept in the GBR.
 ;; These patterns are usually expanded from the respective built-in functions.
-(define_expand "get_thread_pointer"
+(define_expand "get_thread_pointersi"
   [(set (match_operand:SI 0 "register_operand") (reg:SI GBR_REG))]
@@ -10096,7 +10096,7 @@ 
   "stc	gbr,%0"
   [(set_attr "type" "tls_load")])
-(define_expand "set_thread_pointer"
+(define_expand "set_thread_pointersi"
   [(set (reg:SI GBR_REG)
 	(unspec_volatile:SI [(match_operand:SI 0 "register_operand")]