xor to make zero
Just noticed this while digging through skia:10210.
Not super important, but does make programs a little smaller,
and the vpxor reg,reg,reg stands out clearly in disassembly.
Could do the same for all-ones, but I think that's mostly
used from memory directly, by vptest.
Change-Id: I8372f7071a3c951f879d440bbd32640ebdfabf08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287858
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index 831da8e..e42c095 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -2772,7 +2772,11 @@
auto load_from_memory = [&](Reg r, Val v) {
if (instructions[v].op == Op::splat) {
- a->vmovups(r, &constants[instructions[v].immy]);
+ if (instructions[v].immy == 0) {
+ a->vpxor(r,r,r);
+ } else {
+ a->vmovups(r, &constants[instructions[v].immy]);
+ }
} else {
SkASSERT(stack_slot[v] != NA);
a->vmovups(r, A::Mem{A::rsp, stack_slot[v]*K*4});
@@ -2800,7 +2804,11 @@
auto load_from_memory = [&](Reg r, Val v) {
if (instructions[v].op == Op::splat) {
- a->ldrq(r, &constants[instructions[v].immy]);
+ if (instructions[v].immy == 0) {
+ a->eor16b(r,r,r);
+ } else {
+ a->ldrq(r, &constants[instructions[v].immy]);
+ }
} else {
SkASSERT(stack_slot[v] != NA);
a->ldrq(r, A::sp, stack_slot[v]);