[llvm-commits] [llvm] r113919 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp

Bob Wilson bob.wilson at apple.com
Tue Sep 14 18:52:33 PDT 2010


Author: bwilson
Date: Tue Sep 14 20:52:33 2010
New Revision: 113919

URL: http://llvm.org/viewvc/llvm-project?rev=113919&view=rev
Log:
Use float64 instead of int64 vector elements for NEON vget_low and vget_high
functions, since int64 is not a legal type and using it leads to inefficient
code.  PR8036.

Modified:
    llvm/trunk/utils/TableGen/NeonEmitter.cpp

Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=113919&r1=113918&r2=113919&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Sep 14 20:52:33 2010
@@ -552,10 +552,14 @@
   }
   
   std::string ts = TypeString(proto[0], typestr);
-  std::string s = ts + " r; r";
-  
-  if (structTypes)
-    s += ".val";
+  std::string s;
+  if (op == OpHi || op == OpLo) {
+    s = "union { " + ts + " r; double d; } u; u.d";
+  } else {
+    s = ts + " r; r";
+    if (structTypes)
+      s += ".val";
+  }
   
   s += " = ";
 
@@ -631,10 +635,10 @@
     s += ", (__neon_int64x1_t)" + b + ", 0, 1)";
     break;
   case OpHi:
-    s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[1])";
+    s += "(((__neon_float64x2_t)" + a + ")[1])";
     break;
   case OpLo:
-    s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[0])";
+    s += "(((__neon_float64x2_t)" + a + ")[0])";
     break;
   case OpDup:
     s += Duplicate(nElts << (int)quad, typestr, a);
@@ -671,7 +675,10 @@
     throw "unknown OpKind!";
     break;
   }
-  s += "; return r;";
+  if (op == OpHi || op == OpLo)
+    s += "; return u.r;";
+  else
+    s += "; return r;";
   return s;
 }
 
@@ -923,6 +930,11 @@
     }
   }
   OS << "\n";
+  OS << "typedef __attribute__(( __vector_size__(8) ))  "
+    "double __neon_float64x1_t;\n";
+  OS << "typedef __attribute__(( __vector_size__(16) )) "
+    "double __neon_float64x2_t;\n";
+  OS << "\n";
 
   // Emit struct typedefs.
   for (unsigned vi = 1; vi != 5; ++vi) {





More information about the llvm-commits mailing list