fix SIMD bool vector initializers
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 865325c..ff45444 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -2882,11 +2882,13 @@ // SIMD.js has only a fixed set of SIMD types, and no arbitrary vector sizes like <float x 3> or <i8 x 7>, so // codegen rounds up to the smallest appropriate size where the LLVM vector fits. unsigned simdJsNumElements = VT->getNumElements(); - if (simdJsNumElements < 2 && VT->getElementType()->getPrimitiveSizeInBits() > 32) simdJsNumElements = 2; - else if (simdJsNumElements < 4 && VT->getElementType()->getPrimitiveSizeInBits() <= 32) simdJsNumElements = 4; - else if (simdJsNumElements < 8 && VT->getElementType()->getPrimitiveSizeInBits() <= 16) simdJsNumElements = 8; - else if (simdJsNumElements < 16 && VT->getElementType()->getPrimitiveSizeInBits() <= 8) simdJsNumElements = 16; - + auto sizeInBits = VT->getElementType()->getPrimitiveSizeInBits(); + if (sizeInBits > 1) { + if (simdJsNumElements < 2 && sizeInBits > 32) simdJsNumElements = 2; + else if (simdJsNumElements < 4 && sizeInBits <= 32) simdJsNumElements = 4; + else if (simdJsNumElements < 8 && sizeInBits <= 16) simdJsNumElements = 8; + else if (simdJsNumElements < 16 && sizeInBits <= 8) simdJsNumElements = 16; + } for (unsigned i = 1; i < simdJsNumElements; ++i) { Out << ",0"; }