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

Bob Wilson bob.wilson at apple.com
Wed Dec 1 11:49:51 PST 2010


Author: bwilson
Date: Wed Dec  1 13:49:51 2010
New Revision: 120595

URL: http://llvm.org/viewvc/llvm-project?rev=120595&view=rev
Log:
Cleanup: simplify checks for integers between 2 and 4.

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=120595&r1=120594&r2=120595&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Wed Dec  1 13:49:51 2010
@@ -337,7 +337,7 @@
   // returning structs of 2, 3, or 4 vectors which are returned in a sret-like
   // fashion, storing them to a pointer arg.
   if (ret) {
-    if (mod == '2' || mod == '3' || mod == '4')
+    if (mod >= '2' && mod <= '4')
       return "vv*";
     if (mod == 'f' || (ck != ClassB && type == 'f'))
       return quad ? "V4f" : "V2f";
@@ -704,7 +704,7 @@
 
   // If this builtin returns a struct 2, 3, or 4 vectors, pass it as an implicit
   // sret-like argument.
-  bool sret = (proto[0] == '2' || proto[0] == '3' || proto[0] == '4');
+  bool sret = (proto[0] >= '2' && proto[0] <= '4');
 
   // If this builtin takes an immediate argument, we need to #define it rather
   // than use a standard declaration, so that SemaChecking can range check
@@ -755,7 +755,7 @@
     
     // Handle multiple-vector values specially, emitting each subvector as an
     // argument to the __builtin.
-    if (proto[i] == '2' || proto[i] == '3' || proto[i] == '4') {
+    if (proto[i] >= '2' && proto[i] <= '4') {
       for (unsigned vi = 0, ve = proto[i] - '0'; vi != ve; ++vi) {
         s += args + ".val[" + utostr(vi) + "]";
         if ((vi + 1) < ve)
@@ -1131,7 +1131,7 @@
       
       // Builtins that return a struct of multiple vectors have an extra
       // leading arg for the struct return.
-      if (Proto[0] == '2' || Proto[0] == '3' || Proto[0] == '4')
+      if (Proto[0] >= '2' && Proto[0] <= '4')
         ++immidx;
       
       // Add one to the index for each argument until we reach the immediate 





More information about the llvm-commits mailing list