[llvm-commits] [llvm-gcc-4.2] r48292 - /llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp

Dale Johannesen dalej at apple.com
Wed Mar 12 11:56:35 PDT 2008


Author: johannes
Date: Wed Mar 12 13:56:35 2008
New Revision: 48292

URL: http://llvm.org/viewvc/llvm-project?rev=48292&view=rev
Log:
Handle an Altivec edge case the same as gcc.
Better than a compiler crash.


Modified:
    llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=48292&r1=48291&r2=48292&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Wed Mar 12 13:56:35 2008
@@ -205,6 +205,10 @@
   case ALTIVEC_BUILTIN_VSPLTH:
     if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) {
       int EV = Elt->getZExtValue();
+      // gcc accepts anything up to 31, and there is code that tests for it, 
+      // although it doesn't seem to make sense.  Hardware behaves as if mod 8.
+      if (EV>7 && EV<=31)
+        EV = EV%8;
       Result = BuildVectorShuffle(Ops[0], Ops[0],
                                   EV, EV, EV, EV, EV, EV, EV, EV);
     } else {
@@ -215,6 +219,10 @@
   case ALTIVEC_BUILTIN_VSPLTW:
     if (ConstantInt *Elt = dyn_cast<ConstantInt>(Ops[1])) {
       int EV = Elt->getZExtValue();
+      // gcc accepts anything up to 31, and there is code that tests for it, 
+      // although it doesn't seem to make sense.  Hardware behaves as if mod 4.
+      if (EV>3 && EV<=31)
+        EV = EV%4;
       Result = BuildVectorShuffle(Ops[0], Ops[0], EV, EV, EV, EV);
     } else {
       error("%Helement number must be an immediate", &EXPR_LOCATION(exp));





More information about the llvm-commits mailing list