Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[Altivec]vec_dss causes llc fatal error on PowerPC #30239

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR31266
Status NEW
Importance P normal
Reported by kuanghe@ca.ibm.com
Reported on 2016-12-05 09:50:12 -0800
Last modified on 2016-12-06 09:46:17 -0800
Version 3.9
Hardware Other Linux
CC dgregor@apple.com, ehsanamiri@gmail.com, hfinkel@anl.gov, jtony@ca.ibm.com, kit.barton@gmail.com, llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
> cat vec_dss.cc
#include<altivec.h>

int main()
{
    vec_dss(2);
    return (0);
}

> clang++ -c vec_dss.cc -maltivec
fatal error: error in backend: Cannot select: intrinsic %llvm.ppc.altivec.dss
clang-3.9: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 3.9.0 (tags/RELEASE_390/final)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir:
/gsa/tlbgsa/projects/x/xlcmpbld/run/clang/xlclang.3.9/rhel7_leppc/daily/latest/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /home/kuanghe/tmp/vec_dss-ad78a3.cpp
clang-3.9: note: diagnostic msg: /home/kuanghe/tmp/vec_dss-ad78a3.sh
clang-3.9: note: diagnostic msg:

********************
Quuxplusone commented 7 years ago
The builtin is incorrectly defined because the related intrinsic takes an
immediate operand. This fixes it (although we should add a sema check for the
range of the parameter):

Index: include/clang/Basic/BuiltinsPPC.def
===================================================================
--- include/clang/Basic/BuiltinsPPC.def (revision 288810)
+++ include/clang/Basic/BuiltinsPPC.def (working copy)
@@ -56,7 +56,7 @@ BUILTIN(__builtin_altivec_vcfux, "V4fV4ii", "")
 BUILTIN(__builtin_altivec_vctsxs, "V4SiV4fi", "")
 BUILTIN(__builtin_altivec_vctuxs, "V4UiV4fi", "")

-BUILTIN(__builtin_altivec_dss, "vUi", "")
+BUILTIN(__builtin_altivec_dss, "vIi", "")
 BUILTIN(__builtin_altivec_dssall, "v", "")
 BUILTIN(__builtin_altivec_dst, "vvC*iUi", "")
 BUILTIN(__builtin_altivec_dstt, "vvC*iUi", "")
Index: lib/Headers/altivec.h
===================================================================
--- lib/Headers/altivec.h       (revision 288810)
+++ lib/Headers/altivec.h       (working copy)
@@ -3307,11 +3307,8 @@ static __inline__ vector double __ATTRS_o_ai vec_d
 #endif

 /* vec_dss */
+#define vec_dss __builtin_altivec_dss

-static __inline__ void __attribute__((__always_inline__)) vec_dss(int __a) {
-  __builtin_altivec_dss(__a);
-}
-
 /* vec_dssall */

 static __inline__ void __attribute__((__always_inline__)) vec_dssall(void) {