restore select() in bool->int

Change-Id: Ia3ac338bef376aa1649569b9ebd3f7feb23ffd52
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353936
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2021-01-14 12:11:48 -06:00 committed by Skia Commit-Bot
parent 68afd4802b
commit a738fb5d58
2 changed files with 3 additions and 3 deletions

View File

@ -749,7 +749,7 @@ Value SkVMGenerator::writeConstructor(const Constructor& c) {
} else if (srcKind == Type::NumberKind::kBoolean) {
// bool -> int
for (size_t i = 0; i < src.slots(); ++i) {
dst[i] = i32(src[i]) & 1;
dst[i] = skvm::select(i32(src[i]), 1, 0);
}
return dst;
}

View File

@ -12,9 +12,9 @@
10 r3 = eq_i32 r1 r3
11 r3 = bit_xor r4 r3
12 r4 = splat 1 (1.4012985e-45)
13 r4 = bit_and r2 r4
13 r2 = bit_and r4 r2
14 r0 = trunc r0
15 r0 = select r3 r4 r0
15 r0 = select r3 r2 r0
16 r0 = to_f32 r0
17 r0 = mul_f32 r7 r0
loop: