Fix constant folding of vector compares.

Change-Id: If17c2429d38158663c2436e374691a460e3d588c
Reviewed-on: https://swiftshader-review.googlesource.com/5064
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/Intermediate.cpp b/src/OpenGL/compiler/Intermediate.cpp
index bc79a68..eb33972 100644
--- a/src/OpenGL/compiler/Intermediate.cpp
+++ b/src/OpenGL/compiler/Intermediate.cpp
@@ -1043,7 +1043,7 @@
         default:
             return false;
     }
-    
+
     return true;
 }
 
@@ -1539,38 +1539,29 @@
                 break;
 
             case EOpLessThan:
-                assert(objectSize == 1);
-                tempConstArray = new ConstantUnion[1];
-                tempConstArray->setBConst(*unionArray < *rightUnionArray);
-                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr);
+                tempConstArray = new ConstantUnion[objectSize];
+                for(int i = 0; i < objectSize; i++)
+					tempConstArray[i].setBConst(unionArray[i] < rightUnionArray[i]);
+                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
                 break;
             case EOpGreaterThan:
-                assert(objectSize == 1);
-                tempConstArray = new ConstantUnion[1];
-                tempConstArray->setBConst(*unionArray > *rightUnionArray);
-                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr);
+				tempConstArray = new ConstantUnion[objectSize];
+                for(int i = 0; i < objectSize; i++)
+					tempConstArray[i].setBConst(unionArray[i] > rightUnionArray[i]);
+                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
                 break;
             case EOpLessThanEqual:
-                {
-                    assert(objectSize == 1);
-                    ConstantUnion constant;
-                    constant.setBConst(*unionArray > *rightUnionArray);
-                    tempConstArray = new ConstantUnion[1];
-                    tempConstArray->setBConst(!constant.getBConst());
-                    returnType = TType(EbtBool, EbpUndefined, EvqConstExpr);
-                    break;
-                }
+                tempConstArray = new ConstantUnion[objectSize];
+                for(int i = 0; i < objectSize; i++)
+					tempConstArray[i].setBConst(unionArray[i] <= rightUnionArray[i]);
+                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
+                break;
             case EOpGreaterThanEqual:
-                {
-                    assert(objectSize == 1);
-                    ConstantUnion constant;
-                    constant.setBConst(*unionArray < *rightUnionArray);
-                    tempConstArray = new ConstantUnion[1];
-                    tempConstArray->setBConst(!constant.getBConst());
-                    returnType = TType(EbtBool, EbpUndefined, EvqConstExpr);
-                    break;
-                }
-
+                tempConstArray = new ConstantUnion[objectSize];
+                for(int i = 0; i < objectSize; i++)
+					tempConstArray[i].setBConst(unionArray[i] >= rightUnionArray[i]);
+                returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
+                break;
             case EOpEqual:
                 if (getType().getBasicType() == EbtStruct) {
                     if (!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray))