diff --git a/emscripten-version.txt b/emscripten-version.txt index b1a41036cde..6a10ff7aa23 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -1.28.0 +1.28.1 diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp index 8f924007a28..4b8da31df04 100644 --- a/lib/Target/JSBackend/JSBackend.cpp +++ b/lib/Target/JSBackend/JSBackend.cpp @@ -1391,10 +1391,10 @@ void JSWriter::generateFCmpExpression(const FCmpInst *I, raw_string_ostream& Cod bool Invert = false; switch (cast(I)->getPredicate()) { case ICmpInst::FCMP_FALSE: - Code << "SIMD_int32x4(0, 0, 0, 0)"; + Code << "SIMD_int32x4_splat(0)"; return; case ICmpInst::FCMP_TRUE: - Code << "SIMD_int32x4(-1, -1, -1, -1)"; + Code << "SIMD_int32x4_splat(-1)"; return; case ICmpInst::FCMP_ONE: Code << "SIMD_float32x4_and(SIMD_float32x4_and(" @@ -1413,18 +1413,18 @@ void JSWriter::generateFCmpExpression(const FCmpInst *I, raw_string_ostream& Cod << getValueAsStr(I->getOperand(1)) << ")), " << "SIMD_float32x4_equal(" << getValueAsStr(I->getOperand(0)) << ", " << getValueAsStr(I->getOperand(1)) << "))"; - break; + return; case FCmpInst::FCMP_ORD: Code << "SIMD_float32x4_and(" "SIMD_float32x4_equal(" << getValueAsStr(I->getOperand(0)) << ", " << getValueAsStr(I->getOperand(0)) << "), " << "SIMD_float32x4_equal(" << getValueAsStr(I->getOperand(1)) << ", " << getValueAsStr(I->getOperand(1)) << "))"; - break; + return; case FCmpInst::FCMP_UNO: Code << "SIMD_float32x4_or(" "SIMD_float32x4_notEqual(" << getValueAsStr(I->getOperand(0)) << ", " << getValueAsStr(I->getOperand(0)) << "), " << "SIMD_float32x4_notEqual(" << getValueAsStr(I->getOperand(1)) << ", " << getValueAsStr(I->getOperand(1)) << "))"; - break; + return; case ICmpInst::FCMP_OEQ: Name = "equal"; break; case ICmpInst::FCMP_OGT: Name = "greaterThan"; break; diff --git a/test/CodeGen/JS/simd-fcmp.ll b/test/CodeGen/JS/simd-fcmp.ll new file mode 100644 index 00000000000..eab6748ee75 --- /dev/null +++ b/test/CodeGen/JS/simd-fcmp.ll @@ -0,0 +1,37 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" +target triple = "asmjs-unknown-emscripten" + +; CHECK: function _test_ueq($a,$b) { +; CHECK: $a = SIMD_float32x4($a); +; CHECK: $b = SIMD_float32x4($b); +; CHECK: SIMD_float32x4_or(SIMD_float32x4_or(SIMD_float32x4_notEqual($a, $a), SIMD_float32x4_notEqual($b, $b)), SIMD_float32x4_equal($a, $b)); +; CHECK: return (SIMD_int32x4($c)); +; CHECK:} +define <4 x i1> @test_ueq(<4 x float> %a, <4 x float> %b) { + %c = fcmp ueq <4 x float> %a, %b + ret <4 x i1> %c +} + +; CHECK: function _test_ord($a,$b) { +; CHECK: $a = SIMD_float32x4($a); +; CHECK: $b = SIMD_float32x4($b); +; CHECK: SIMD_float32x4_or(SIMD_float32x4_or(SIMD_float32x4_notEqual($a, $a), SIMD_float32x4_notEqual($b, $b)), SIMD_float32x4_equal($a, $b)); +; CHECK: return (SIMD_int32x4($c)); +; CHECK:} +define <4 x i1> @test_ord(<4 x float> %a, <4 x float> %b) { + %c = fcmp ueq <4 x float> %a, %b + ret <4 x i1> %c +} + +; CHECK:function _test_uno($a,$b) { +; CHECK: $a = SIMD_float32x4($a); +; CHECK: $b = SIMD_float32x4($b); +; CHECK: SIMD_float32x4_or(SIMD_float32x4_or(SIMD_float32x4_notEqual($a, $a), SIMD_float32x4_notEqual($b, $b)), SIMD_float32x4_equal($a, $b)); +; CHECK: return (SIMD_int32x4($c)); +; CHECK:} +define <4 x i1> @test_uno(<4 x float> %a, <4 x float> %b) { + %c = fcmp ueq <4 x float> %a, %b + ret <4 x i1> %c +}