public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, spu] fix wrong parameter type in spu intrinsics
@ 2008-02-05 14:07 Sa Liu
  2008-02-08  3:04 ` Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Sa Liu @ 2008-02-05 14:07 UTC (permalink / raw)
  To: gcc-patches

The spu intrinsics spu_convtf, spu_convts and spu_convtu have parameter 
scale of type unsigned int (7-bit literal). Values outside  the range of 
[0, 127] should be flagged as an error and compilation is terminated. 
Currently the compiler doesn't output the error message, but terminates 
with an internal compiler error. This has been fixed by specifying proper 
argument type in the built-in defination.

Ok for mainline?

Index: gcc/gcc/config/spu/spu-builtins.def
===================================================================
--- gcc.orig/gcc/config/spu/spu-builtins.def
+++ gcc/gcc/config/spu/spu-builtins.def
@@ -235,8 +235,8 @@ DEF_BUILTIN (SI_FROM_PTR,    CODE_FOR_sp
 
 /* definitions to support generic builtin functions: */
 
-DEF_BUILTIN (SPU_CONVTS,     CODE_FOR_spu_cflts,      "spu_convts", 
B_INSN,     _A3(SPU_BTI_V4SI,     SPU_BTI_V4SF,   SPU_BTI_INTSI))
-DEF_BUILTIN (SPU_CONVTU,     CODE_FOR_spu_cfltu,      "spu_convtu", 
B_INSN,     _A3(SPU_BTI_UV4SI,    SPU_BTI_V4SF,   SPU_BTI_INTSI))
+DEF_BUILTIN (SPU_CONVTS,     CODE_FOR_spu_cflts,      "spu_convts", 
B_INSN,     _A3(SPU_BTI_V4SI,     SPU_BTI_V4SF,   SPU_BTI_U7))
+DEF_BUILTIN (SPU_CONVTU,     CODE_FOR_spu_cfltu,      "spu_convtu", 
B_INSN,     _A3(SPU_BTI_UV4SI,    SPU_BTI_V4SF,   SPU_BTI_U7))
 DEF_BUILTIN (SPU_ROUNDTF,    CODE_FOR_spu_frds,       "spu_roundtf", 
B_INSN,     _A2(SPU_BTI_V4SF,     SPU_BTI_V2DF))
 DEF_BUILTIN (SPU_MULH,       CODE_FOR_spu_mpyh,       "spu_mulh", B_INSN, 
    _A3(SPU_BTI_V4SI,     SPU_BTI_V8HI,   SPU_BTI_V8HI))
 DEF_BUILTIN (SPU_MULSR,      CODE_FOR_spu_mpys,       "spu_mulsr", 
B_INSN,     _A3(SPU_BTI_V4SI,     SPU_BTI_V8HI,   SPU_BTI_V8HI))
@@ -257,8 +257,8 @@ DEF_BUILTIN (SPU_TESTSV,     CODE_FOR_df
 /* definitions to support overloaded generic builtin functions:  */
 
 DEF_BUILTIN (SPU_CONVTF,           CODE_FOR_nothing,       "spu_convtf",  
        B_OVERLOAD, _A1(SPU_BTI_VOID))
-DEF_BUILTIN (SPU_CONVTF_0,         CODE_FOR_spu_cuflt, "spu_convtf_0",   
B_INTERNAL, _A3(SPU_BTI_V4SF,   SPU_BTI_UV4SI,  SPU_BTI_UINTSI))
-DEF_BUILTIN (SPU_CONVTF_1,         CODE_FOR_spu_csflt, "spu_convtf_1",   
B_INTERNAL, _A3(SPU_BTI_V4SF,   SPU_BTI_V4SI,   SPU_BTI_UINTSI))
+DEF_BUILTIN (SPU_CONVTF_0,         CODE_FOR_spu_cuflt, "spu_convtf_0",   
B_INTERNAL, _A3(SPU_BTI_V4SF,   SPU_BTI_UV4SI,  SPU_BTI_U7))
+DEF_BUILTIN (SPU_CONVTF_1,         CODE_FOR_spu_csflt, "spu_convtf_1",   
B_INTERNAL, _A3(SPU_BTI_V4SF,   SPU_BTI_V4SI,   SPU_BTI_U7))
 DEF_BUILTIN (SPU_EXTEND,           CODE_FOR_nothing,       "spu_extend",  
        B_OVERLOAD, _A1(SPU_BTI_VOID))
 DEF_BUILTIN (SPU_EXTEND_0,         CODE_FOR_spu_xsbh, "spu_extend_0",  
B_INTERNAL, _A2(SPU_BTI_V8HI,   SPU_BTI_V16QI))
 DEF_BUILTIN (SPU_EXTEND_1,         CODE_FOR_spu_xshw, "spu_extend_1",  
B_INTERNAL, _A2(SPU_BTI_V4SI,   SPU_BTI_V8HI))

Thanks!
Sa

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, spu] fix wrong parameter type in spu intrinsics
  2008-02-05 14:07 [PATCH, spu] fix wrong parameter type in spu intrinsics Sa Liu
@ 2008-02-08  3:04 ` Andrew Pinski
  2008-02-08 14:58   ` Sa Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2008-02-08  3:04 UTC (permalink / raw)
  To: Sa Liu; +Cc: gcc-patches

On 2/5/08, Sa Liu <SALIU@de.ibm.com> wrote:
> The spu intrinsics spu_convtf, spu_convts and spu_convtu have parameter
> scale of type unsigned int (7-bit literal). Values outside  the range of
> [0, 127] should be flagged as an error and compilation is terminated.
> Currently the compiler doesn't output the error message, but terminates
> with an internal compiler error. This has been fixed by specifying proper
> argument type in the built-in defination.
>
> Ok for mainline?

This is ok with testcases and a changelog entry.

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, spu] fix wrong parameter type in spu intrinsics
  2008-02-08  3:04 ` Andrew Pinski
@ 2008-02-08 14:58   ` Sa Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Sa Liu @ 2008-02-08 14:58 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches

"Andrew Pinski" <pinskia@gmail.com> wrote on 08.02.2008 03:53:18:

> This is ok with testcases and a changelog entry.

Ok, patch committed and added test case intrinsics-3.c to 
testsuite/gcc.target/spu/.

Index: gcc/gcc/testsuite/gcc.target/spu/intrinsics-3.c
===================================================================
--- /dev/null
+++ gcc/gcc/testsuite/gcc.target/spu/intrinsics-3.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+#include <spu_intrinsics.h>
+void f0 (vec_uint4 *in)
+{
+  vec_float4 out = spu_convtf (in[0], 128); /* { dg-error "expects an 
integer literal in the range" "0, 127"  }*/
+}
+
+void f1 (vec_int4 *in)
+{
+  vec_float4 out = spu_convtf (in[0], 128); /* { dg-error "expects an 
integer literal in the range" "0, 127"  }*/
+}
+
+void f2 (vec_float4 *in)
+{
+  vec_int4 out = spu_convts (in[0], 128); /* { dg-error "expects an 
integer literal in the range" "0, 127"  }*/
+}
+
+void f3 (vec_float4 *in)
+{
+  vec_uint4 out = spu_convtu (in[0], 128); /* { dg-error "expects an 
integer literal in the range" "0, 127"  }*/
+}


Thanks!
Sa

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-08 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05 14:07 [PATCH, spu] fix wrong parameter type in spu intrinsics Sa Liu
2008-02-08  3:04 ` Andrew Pinski
2008-02-08 14:58   ` Sa Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).