goalc: reduce cleverness of outer product (#1059)

* goalc: reduce cleverness of outer product

* decomp: update existing outer product usages

* let the tests still run the fancy one
This commit is contained in:
Tyler Wilding
2022-01-09 11:39:22 -05:00
committed by GitHub
parent 1aab98b335
commit a2e6413b76
17 changed files with 259 additions and 101 deletions
+2 -3
View File
@@ -96,9 +96,8 @@ const std::map<InstructionKind, OpenGOALAsm::Function> MIPS_ASM_TO_OPEN_GOAL_FUN
{InstructionKind::VABS, {".abs.vf", {MOD::DEST_MASK}}},
// Outer-product
// NOTE - currently it's assumed these groups of instructions will be replaced with 1
{InstructionKind::VOPMULA, {"TODO.VOPMULA.vf", {}}},
{InstructionKind::VOPMSUB, {".outer.product.vf", {MOD::SWAP_FIRST_TWO_SOURCE_ARGS}}},
{InstructionKind::VOPMULA, {".outer.product.a.vf", {}}},
{InstructionKind::VOPMSUB, {".outer.product.b.vf", {MOD::ACC_THIRD_SRC_ARG}}},
// Division
{InstructionKind::VDIV, {".div.vf", {MOD::FTF, MOD::FSF}}},
@@ -45,12 +45,6 @@ bool rewrite_inline_asm_instructions(Form* top_level_form,
asmOp.instr.to_string(f.ir2.env.file->labels));
new_entries.push_back(entry);
continue;
} else if (elem->op()->instruction().kind == InstructionKind::VOPMULA) {
// So far, the only instruction we deal with in pairs is the outer-product
// This is kinda a hack, internally the src args of VOPMSUB will be swapped which is
// correct and the first op we skip.
// In the future if this needs to support more, it will be worth cleaning this up
continue;
} else if (asmOp.todo) {
// If its an invalid or unsupported exception, skip it
/*lg::warn("[ASM Re-Write] - Inline assembly instruction marked with TODO - [{}]",
+6 -3
View File
@@ -1157,9 +1157,12 @@
(.add.w.vf vf4 vf0 vf5 :mask #b0100)
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
;; outer prods
(.outer.product.vf vf2 vf6 vf2)
(.outer.product.vf vf3 vf6 vf3)
(.outer.product.vf vf4 vf6 vf4)
(.outer.product.a.vf acc vf6 vf2)
(.outer.product.b.vf vf2 vf2 vf6 acc)
(.outer.product.a.vf acc vf6 vf3)
(.outer.product.b.vf vf3 vf3 vf6 acc)
(.outer.product.a.vf acc vf6 vf4)
(.outer.product.b.vf vf4 vf4 vf6 acc)
;; add ones
(.add.w.vf vf2 vf2 vf0 :mask #b0001)
(.add.w.vf vf3 vf3 vf0 :mask #b0010)
+3 -2
View File
@@ -341,7 +341,8 @@
(.lvf vf6 (&-> arg2 quad))
(.lvf vf7 (&-> arg3 quad))
(.sub.vf vf8 vf3 vf6)
(.outer.product.vf vf4 vf2 vf1)
(.outer.product.a.vf acc vf2 vf1)
(.outer.product.b.vf vf4 vf1 vf2 acc)
(.mul.vf vf8 vf8 vf4)
(.mul.vf vf9 vf7 vf4)
(.mul.vf vf5 vf4 vf4)
@@ -400,4 +401,4 @@
)
)
;; moving-sphere-moving-sphere-intersect (unused)
;; moving-sphere-moving-sphere-intersect (unused)
+50 -23
View File
@@ -21,8 +21,12 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2) ;; has the right magnitude, but rotation is off by 90 degrees
(.outer.product.vf vf3 vf2 vf3) ;; rotate by 90 about normal of plane
;; has the right magnitude, but rotation is off by 90 degrees
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
;; rotate by 90 about normal of plane
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
dst
)
@@ -44,8 +48,11 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3) ;; vf3 is the projection on the plane
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
;; vf3 is the projection on the plane
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.add.vf acc vf3 vf3 :mask #b111) ;; double that part
(.sub.mul.w.vf vf3 vf1 vf0 acc :mask #b111) ;; and subtract the original
(.svf (&-> dst quad) vf3)
@@ -70,8 +77,11 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3) ;; part on the plane (requires normal to be unit)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
;; part on the plane (requires normal to be unit)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.add.vf vf3 vf3 vf2 :mask #b111) ;; add normal to that.
(.svf (&-> dst quad) vf3)
dst
@@ -90,8 +100,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
dst
)
@@ -111,8 +123,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
;; dst is now the normal part of src
@@ -246,9 +260,12 @@
(.sub.x.vf vf4 vf0 vf1 :mask #b10)
(.add.w.vf vf4 vf0 vf1 :mask #b100)
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
(.outer.product.vf vf2 vf5 vf2)
(.outer.product.vf vf3 vf5 vf3)
(.outer.product.vf vf4 vf5 vf4)
(.outer.product.a.vf acc vf5 vf2)
(.outer.product.b.vf vf2 vf2 vf5 acc)
(.outer.product.a.vf acc vf5 vf3)
(.outer.product.b.vf vf3 vf3 vf5 acc)
(.outer.product.a.vf acc vf5 vf4)
(.outer.product.b.vf vf4 vf4 vf5 acc)
(.add.w.vf vf2 vf2 vf0 :mask #b1)
(.add.w.vf vf3 vf3 vf0 :mask #b10)
(.add.w.vf vf4 vf4 vf0 :mask #b100)
@@ -590,7 +607,8 @@
(.lvf vf2 (&-> arg3 quad))
(.sub.vf vf1 vf3 vf1)
(.sub.vf vf2 vf3 vf2)
(.outer.product.vf vf4 vf2 vf1)
(.outer.product.a.vf acc vf2 vf1)
(.outer.product.b.vf vf4 vf1 vf2 acc)
(.mul.vf vf5 vf4 vf4)
(.add.y.vf vf5 vf5 vf5 :mask #b1)
(.add.z.vf vf5 vf5 vf5 :mask #b1)
@@ -620,7 +638,8 @@
(.add.x.vf vf4 vf0 vf0 :mask #b1000)
(.sub.vf vf2 vf2 vf1)
(.sub.vf vf3 vf3 vf1)
(.outer.product.vf vf4 vf2 vf3)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf4 vf3 vf2 acc)
(.svf (&-> arg0 quad) vf4)
arg0
)
@@ -675,10 +694,13 @@
(.sub.vf vf8 vf3 vf2)
(.sub.vf vf9 vf5 vf4)
(.sub.vf vf10 vf5 vf2)
(.outer.product.vf vf14 vf7 vf8)
(.outer.product.vf vf15 vf6 vf7)
(.outer.product.a.vf acc vf7 vf8)
(.outer.product.b.vf vf14 vf8 vf7 acc)
(.outer.product.a.vf acc vf6 vf7)
(.outer.product.b.vf vf15 vf7 vf6 acc)
(.mul.vf vf11 vf14 vf1)
(.outer.product.vf vf16 vf9 vf10)
(.outer.product.a.vf acc vf9 vf10)
(.outer.product.b.vf vf16 vf10 vf9 acc)
(.mul.vf vf12 vf15 vf1)
(.add.x.vf vf11 vf11 vf11 :mask #b10)
(.mul.vf vf13 vf16 vf1)
@@ -702,8 +724,10 @@
)
(.sub.vf vf17 vf5 vf2)
(.mov.vf vf18 vf0 :mask #b1000)
(.outer.product.vf vf18 vf17 vf1)
(.outer.product.vf vf18 vf1 vf18)
(.outer.product.a.vf acc vf17 vf1)
(.outer.product.b.vf vf18 vf1 vf17 acc)
(.outer.product.a.vf acc vf1 vf18)
(.outer.product.b.vf vf18 vf18 vf1 acc)
(.add.vf vf18 vf18 vf2 :mask #b111)
(b! #t cfg-24 :delay (.svf (&-> arg0 quad) vf18))
(nop!)
@@ -831,9 +855,12 @@
(.sub.vf vf8 vf3 vf2)
(.sub.vf vf9 vf5 vf4)
(.sub.vf vf10 vf5 vf2)
(.outer.product.vf vf2 vf6 vf7)
(.outer.product.vf vf3 vf7 vf8)
(.outer.product.vf vf4 vf9 vf10)
(.outer.product.a.vf acc vf6 vf7)
(.outer.product.b.vf vf2 vf7 vf6 acc)
(.outer.product.a.vf acc vf7 vf8)
(.outer.product.b.vf vf3 vf8 vf7 acc)
(.outer.product.a.vf acc vf9 vf10)
(.outer.product.b.vf vf4 vf10 vf9 acc)
(.mul.vf vf2 vf2 vf1)
(.mul.vf vf3 vf3 vf1)
(.nop.vf)
+8 -4
View File
@@ -1166,7 +1166,8 @@
(.lvf vf11 (&-> arg0 vector 1 quad))
(.lvf vf12 (&-> arg0 vector 2 quad))
(.lvf vf10 (&-> arg0 vector 0 quad))
(.outer.product.vf vf13 vf11 vf12)
(.outer.product.a.vf acc vf11 vf12)
(.outer.product.b.vf vf13 vf12 vf11 acc)
(.mul.vf vf13 vf13 vf10 :mask #b111)
(.add.y.vf vf13 vf13 vf13 :mask #b1)
(.add.z.vf vf13 vf13 vf13 :mask #b1)
@@ -1366,10 +1367,13 @@
(.lvf vf10 (&-> src vector 0 quad))
(.lvf vf11 (&-> src vector 1 quad))
(.lvf vf12 (&-> src vector 2 quad))
(.outer.product.vf vf13 vf11 vf12)
(.outer.product.vf vf14 vf12 vf10)
(.outer.product.a.vf acc vf11 vf12)
(.outer.product.b.vf vf13 vf12 vf11 acc)
(.outer.product.a.vf acc vf12 vf10)
(.outer.product.b.vf vf14 vf10 vf12 acc)
(.mul.vf vf1 vf10 vf13 :mask #b111)
(.outer.product.vf vf15 vf10 vf11)
(.outer.product.a.vf acc vf10 vf11)
(.outer.product.b.vf vf15 vf11 vf10 acc)
(.nop.vf)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.nop.vf)
+12 -8
View File
@@ -332,7 +332,8 @@
(.lvf vf2 (&-> arg2 vec quad))
(.sub.vf vf4 vf0 vf0 :mask #b1000)
(.mul.vf vf3 vf1 vf2)
(.outer.product.vf vf4 vf1 vf2)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf4 vf2 vf1 acc)
(.mul.w.vf acc vf1 vf2)
(.add.mul.w.vf acc vf2 vf1 acc)
(.sub.mul.w.vf acc vf0 vf3 acc :mask #b1000)
@@ -428,9 +429,12 @@
(.sub.x.vf vf4 vf0 vf1 :mask #b10)
(.add.w.vf vf4 vf0 vf1 :mask #b100)
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
(.outer.product.vf vf2 vf5 vf2)
(.outer.product.vf vf3 vf5 vf3)
(.outer.product.vf vf4 vf5 vf4)
(.outer.product.a.vf acc vf5 vf2)
(.outer.product.b.vf vf2 vf2 vf5 acc)
(.outer.product.a.vf acc vf5 vf3)
(.outer.product.b.vf vf3 vf3 vf5 acc)
(.outer.product.a.vf acc vf5 vf4)
(.outer.product.b.vf vf4 vf4 vf5 acc)
(.add.w.vf vf2 vf2 vf0 :mask #b1)
(.add.w.vf vf3 vf3 vf0 :mask #b10)
(.add.w.vf vf4 vf4 vf0 :mask #b100)
@@ -848,10 +852,10 @@
(.sub.vf vf4 vf0 vf4 :mask #b110)
(.add.vf vf3 vf0 vf1 :mask #b111)
(.mul.x.vf vf3 vf0 vf2 :mask #b1000)
; (.outer.product.vf vf6 vf0 vf0)
(quaternion-vompula-hack vf6 vf1)
(quaternion-vompula-hack vf5 vf2)
; (.outer.product.vf vf5 vf0 vf0)
(.outer.product.a.vf acc vf1 vf1)
(.outer.product.b.vf vf6 vf0 vf0 acc)
(.outer.product.a.vf acc vf2 vf2)
(.outer.product.b.vf vf5 vf0 vf0 acc)
(.mul.x.vf vf6 vf0 vf6 :mask #b1000)
(.mul.x.vf vf5 vf0 vf5 :mask #b1000)
(.mul.vf acc vf6 vf4)
+2 -1
View File
@@ -14,7 +14,8 @@
)
(.lvf vf1 (&-> arg1 quad))
(.lvf vf2 (&-> arg2 quad))
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.svf (&-> arg0 quad) vf3)
arg0
)
+2
View File
@@ -486,6 +486,8 @@ class Compiler {
Val* compile_asm_abs_vf(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_outer_product_vf(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_outer_product_a_vf(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_outer_product_b_vf(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_div_vf(const goos::Object& form, const goos::Object& rest, Env* env);
Val* compile_asm_sqrt_vf(const goos::Object& form, const goos::Object& rest, Env* env);
+91
View File
@@ -1358,3 +1358,94 @@ Val* Compiler::compile_asm_outer_product_vf(const goos::Object& form,
env->emit_ir<IR_BlendVF>(form, color, dest, dest, temp2, 0b0111);
return get_none();
}
Val* Compiler::compile_asm_outer_product_a_vf(const goos::Object& form,
const goos::Object& rest,
Env* env) {
auto args = get_va(form, rest);
va_check(form, args, {{}, {}, {}}, {{"color", {false, goos::ObjectType::SYMBOL}}});
bool color = true;
if (args.has_named("color")) {
color = get_true_or_false(form, args.named.at("color"));
}
auto dest = compile_error_guard(args.unnamed.at(0), env)->to_reg(form, env);
auto src1 = compile_error_guard(args.unnamed.at(1), env)->to_reg(form, env);
auto src2 = compile_error_guard(args.unnamed.at(2), env)->to_reg(form, env);
check_vector_float_regs(form, env,
{{"destination", dest}, {"first source", src1}, {"second source", src2}});
// Given 2 vectors V1 = <1,2,3,4> and V2 = <5,6,7,8> and assume VDEST = <0, 0, 0, 999>
// The outer product is computed like so (only x,y,z components are operated on):
// x = V1y * V2z => (2 * 7) => 14
// y = V1z * V2x => (3 * 5) => 15
// z = V1x * V2y => (1 * 6) => 6
// w = N/A, left alone => 999
//
// Some temporary regs are required AND its important to not modify dest's `w` or the source
// registers at all
// Init two temp registers
auto temp1 = env->make_vfr(dest->type());
auto temp2 = env->make_vfr(dest->type());
// - Swizzle src1 appropriately
env->emit_ir<IR_SwizzleVF>(form, color, temp1, src1, 0b00001001);
// - Swizzle src2 appropriately
env->emit_ir<IR_SwizzleVF>(form, color, temp2, src2, 0b00010010);
// - Multiply - Result in `dest`
env->emit_ir<IR_VFMath3Asm>(form, color, temp1, temp1, temp2, IR_VFMath3Asm::Kind::MUL);
// - Move it into 'dest' safely (avoid mutating `w`)
env->emit_ir<IR_BlendVF>(form, color, dest, temp1, temp1, 0b0111);
return get_none();
}
Val* Compiler::compile_asm_outer_product_b_vf(const goos::Object& form,
const goos::Object& rest,
Env* env) {
auto args = get_va(form, rest);
va_check(form, args, {{}, {}, {}, {}}, {{"color", {false, goos::ObjectType::SYMBOL}}});
bool color = true;
if (args.has_named("color")) {
color = get_true_or_false(form, args.named.at("color"));
}
auto dest = compile_error_guard(args.unnamed.at(0), env)->to_reg(form, env);
auto src1 = compile_error_guard(args.unnamed.at(1), env)->to_reg(form, env);
auto src2 = compile_error_guard(args.unnamed.at(2), env)->to_reg(form, env);
auto acc = compile_error_guard(args.unnamed.at(3), env)->to_reg(form, env);
check_vector_float_regs(form, env,
{{"destination", dest},
{"first source", src1},
{"second source", src2},
{"acc source", acc}});
// Given 2 vectors V1 = <1,2,3,4> and V2 = <5,6,7,8> and assume VDEST = <0, 0, 0, 999>
// also assume ACC = <14, 15, 6>
// The outer product is computed like so (only x,y,z components are operated on):
// x = ACCx - (V1y * V2z) => 14 - (2 * 7) => 0
// y = ACCy - (V1z * V2x) => 15 - (3 * 5) => 0
// z = ACCz - (V1x * V2y) => 6 - (1 * 6) => 0
// w = N/A, left alone => 999
//
// Some temporary regs are required AND its important to not modify dest's `w` or the source
// registers at all
// Init two temp registers
auto temp1 = env->make_vfr(dest->type());
auto temp2 = env->make_vfr(dest->type());
// - Swizzle src1 appropriately
env->emit_ir<IR_SwizzleVF>(form, color, temp1, src1, 0b00001001);
// - Swizzle src2 appropriately
env->emit_ir<IR_SwizzleVF>(form, color, temp2, src2, 0b00010010);
// - Multiply - Result in `dest`
env->emit_ir<IR_VFMath3Asm>(form, color, temp1, temp1, temp2, IR_VFMath3Asm::Kind::MUL);
// - Subtract - (ACC - Result Above)
env->emit_ir<IR_VFMath3Asm>(form, color, temp1, acc, temp1, IR_VFMath3Asm::Kind::SUB);
// - Move it into 'dest' safely (avoid mutating `w`)
env->emit_ir<IR_BlendVF>(form, color, dest, temp1, temp1, 0b0111);
return get_none();
}
+4
View File
@@ -85,7 +85,11 @@ const std::unordered_map<
// However, we can be better than that and just provide a single instruction
// BUT - if things used side effects of the modified ACC or benefited from only doing 1/2
// operations, we'll need to implement them separately.
//
// ...and they did
{".outer.product.vf", &Compiler::compile_asm_outer_product_vf},
{".outer.product.a.vf", &Compiler::compile_asm_outer_product_a_vf},
{".outer.product.b.vf", &Compiler::compile_asm_outer_product_b_vf},
{".div.vf", &Compiler::compile_asm_div_vf},
{".sqrt.vf", &Compiler::compile_asm_sqrt_vf},
+3 -3
View File
@@ -2260,11 +2260,11 @@ class IGen {
`dst`'s element (W->X).
- GROUP OPTIONS
- 00b - Copy the least-significant element (X)
- 01b - Copy the second element (from the right)
- 10b - Copy the third element (from the right)
- 01b - Copy the second element (from the right) (Y)
- 10b - Copy the third element (from the right) (Z)
- 11b - Copy the most significant element (W)
Examples
; xmm1 = (1.5, 2.5, 3.5, 4.5)
; xmm1 = (1.5, 2.5, 3.5, 4.5) (W,Z,Y,X in x86 land)
SHUFPS xmm1, xmm1, 0xff ; Copy the most significant element to all positions
> (1.5, 1.5, 1.5, 1.5)
SHUFPS xmm1, xmm1, 0x39 ; Rotate right
+10 -9
View File
@@ -192,7 +192,8 @@
(.lvf vf6 (&-> arg2 quad))
(.lvf vf7 (&-> arg3 quad))
(.sub.vf vf8 vf3 vf6)
(.outer.product.vf vf4 vf2 vf1)
(.outer.product.a.vf acc vf2 vf1)
(.outer.product.b.vf vf4 vf1 vf2 acc)
(.mul.vf vf8 vf8 vf4)
(.mul.vf vf9 vf7 vf4)
(.mul.vf vf5 vf4 vf4)
@@ -275,7 +276,8 @@
(.sub.vf vf5 vf2 vf3)
(.sub.vf vf10 vf2 vf8)
(.mul.vf vf17 vf9 vf9)
(.outer.product.vf vf6 vf5 vf4)
(.outer.product.a.vf acc vf5 vf4)
(.outer.product.b.vf vf6 vf4 vf5 acc)
(.add.y.vf vf17 vf17 vf17 :mask #b1)
(.mul.vf vf7 vf6 vf6)
(.mul.vf vf10 vf10 vf6)
@@ -308,9 +310,12 @@
(.sub.vf vf20 vf13 vf3)
(.sub.vf vf21 vf13 vf1)
(.isqrt.vf Q vf0 vf17 :fsf #b11 :ftf #b0)
(.outer.product.vf vf14 vf5 vf19)
(.outer.product.vf vf15 vf19 vf4)
(.outer.product.vf vf16 vf20 vf21)
(.outer.product.a.vf acc vf5 vf19)
(.outer.product.b.vf vf14 vf19 vf5 acc)
(.outer.product.a.vf acc vf19 vf4)
(.outer.product.b.vf vf15 vf4 vf19 acc)
(.outer.product.a.vf acc vf20 vf21)
(.outer.product.b.vf vf16 vf21 vf20 acc)
(.mul.vf vf14 vf14 vf6 :mask #b111)
(.mul.vf vf15 vf15 vf6 :mask #b111)
(.mul.vf vf16 vf16 vf6 :mask #b111)
@@ -378,7 +383,3 @@
f30-0
)
)
+46 -23
View File
@@ -13,8 +13,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
dst
)
@@ -32,8 +34,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.add.vf acc vf3 vf3 :mask #b111)
(.sub.mul.w.vf vf3 vf1 vf0 acc :mask #b111)
(.svf (&-> dst quad) vf3)
@@ -53,8 +57,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.add.vf vf3 vf3 vf2 :mask #b111)
(.svf (&-> dst quad) vf3)
dst
@@ -73,8 +79,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
dst
)
@@ -92,8 +100,10 @@
(.lvf vf1 (&-> src quad))
(.lvf vf2 (&-> plane-normal quad))
(.mov.vf vf3 vf0 :mask #b1000)
(.outer.product.vf vf3 vf1 vf2)
(.outer.product.vf vf3 vf2 vf3)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf3 vf2 vf1 acc)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf3 vf3 vf2 acc)
(.svf (&-> dst quad) vf3)
(let* ((f0-0 (vector-length dst))
(f1-1 (vector-dot dst plane-normal))
@@ -228,9 +238,12 @@
(.sub.x.vf vf4 vf0 vf1 :mask #b10)
(.add.w.vf vf4 vf0 vf1 :mask #b100)
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
(.outer.product.vf vf2 vf5 vf2)
(.outer.product.vf vf3 vf5 vf3)
(.outer.product.vf vf4 vf5 vf4)
(.outer.product.a.vf acc vf5 vf2)
(.outer.product.b.vf vf2 vf2 vf5 acc)
(.outer.product.a.vf acc vf5 vf3)
(.outer.product.b.vf vf3 vf3 vf5 acc)
(.outer.product.a.vf acc vf5 vf4)
(.outer.product.b.vf vf4 vf4 vf5 acc)
(.add.w.vf vf2 vf2 vf0 :mask #b1)
(.add.w.vf vf3 vf3 vf0 :mask #b10)
(.add.w.vf vf4 vf4 vf0 :mask #b100)
@@ -583,7 +596,8 @@
(.lvf vf2 (&-> arg3 quad))
(.sub.vf vf1 vf3 vf1)
(.sub.vf vf2 vf3 vf2)
(.outer.product.vf vf4 vf2 vf1)
(.outer.product.a.vf acc vf2 vf1)
(.outer.product.b.vf vf4 vf1 vf2 acc)
(.mul.vf vf5 vf4 vf4)
(.add.y.vf vf5 vf5 vf5 :mask #b1)
(.add.z.vf vf5 vf5 vf5 :mask #b1)
@@ -614,7 +628,8 @@
(.add.x.vf vf4 vf0 vf0 :mask #b1000)
(.sub.vf vf2 vf2 vf1)
(.sub.vf vf3 vf3 vf1)
(.outer.product.vf vf4 vf2 vf3)
(.outer.product.a.vf acc vf2 vf3)
(.outer.product.b.vf vf4 vf3 vf2 acc)
(.svf (&-> arg0 quad) vf4)
arg0
)
@@ -661,10 +676,13 @@
(.sub.vf vf8 vf3 vf2)
(.sub.vf vf9 vf5 vf4)
(.sub.vf vf10 vf5 vf2)
(.outer.product.vf vf14 vf7 vf8)
(.outer.product.vf vf15 vf6 vf7)
(.outer.product.a.vf acc vf7 vf8)
(.outer.product.b.vf vf14 vf8 vf7 acc)
(.outer.product.a.vf acc vf6 vf7)
(.outer.product.b.vf vf15 vf7 vf6 acc)
(.mul.vf vf11 vf14 vf1)
(.outer.product.vf vf16 vf9 vf10)
(.outer.product.a.vf acc vf9 vf10)
(.outer.product.b.vf vf16 vf10 vf9 acc)
(.mul.vf vf12 vf15 vf1)
(.add.x.vf vf11 vf11 vf11 :mask #b10)
(.mul.vf vf13 vf16 vf1)
@@ -687,8 +705,10 @@
)
(.sub.vf vf17 vf5 vf2)
(.mov.vf vf18 vf0 :mask #b1000)
(.outer.product.vf vf18 vf17 vf1)
(.outer.product.vf vf18 vf1 vf18)
(.outer.product.a.vf acc vf17 vf1)
(.outer.product.b.vf vf18 vf1 vf17 acc)
(.outer.product.a.vf acc vf1 vf18)
(.outer.product.b.vf vf18 vf18 vf1 acc)
(.add.vf vf18 vf18 vf2 :mask #b111)
(b! #t cfg-24 :delay (.svf (&-> arg0 quad) vf18))
(nop!)
@@ -765,9 +785,12 @@
(.sub.vf vf8 vf3 vf2)
(.sub.vf vf9 vf5 vf4)
(.sub.vf vf10 vf5 vf2)
(.outer.product.vf vf2 vf6 vf7)
(.outer.product.vf vf3 vf7 vf8)
(.outer.product.vf vf4 vf9 vf10)
(.outer.product.a.vf acc vf6 vf7)
(.outer.product.b.vf vf2 vf7 vf6 acc)
(.outer.product.a.vf acc vf7 vf8)
(.outer.product.b.vf vf3 vf8 vf7 acc)
(.outer.product.a.vf acc vf9 vf10)
(.outer.product.b.vf vf4 vf10 vf9 acc)
(.mul.vf vf2 vf2 vf1)
(.mul.vf vf3 vf3 vf1)
(.nop.vf)
+8 -4
View File
@@ -829,7 +829,8 @@
(.lvf vf11 (&-> arg0 vector 1 quad))
(.lvf vf12 (&-> arg0 vector 2 quad))
(.lvf vf10 (&-> arg0 vector 0 quad))
(.outer.product.vf vf13 vf11 vf12)
(.outer.product.a.vf acc vf11 vf12)
(.outer.product.b.vf vf13 vf12 vf11 acc)
(.mul.vf vf13 vf13 vf10 :mask #b111)
(.add.y.vf vf13 vf13 vf13 :mask #b1)
(.add.z.vf vf13 vf13 vf13 :mask #b1)
@@ -923,10 +924,13 @@
(.lvf vf10 (&-> src vector 0 quad))
(.lvf vf11 (&-> src vector 1 quad))
(.lvf vf12 (&-> src vector 2 quad))
(.outer.product.vf vf13 vf11 vf12)
(.outer.product.vf vf14 vf12 vf10)
(.outer.product.a.vf acc vf11 vf12)
(.outer.product.b.vf vf13 vf12 vf11 acc)
(.outer.product.a.vf acc vf12 vf10)
(.outer.product.b.vf vf14 vf10 vf12 acc)
(.mul.vf vf1 vf10 vf13 :mask #b111)
(.outer.product.vf vf15 vf10 vf11)
(.outer.product.a.vf acc vf10 vf11)
(.outer.product.b.vf vf15 vf11 vf10 acc)
(.nop.vf)
(.add.y.vf vf1 vf1 vf1 :mask #b1)
(.nop.vf)
+12 -6
View File
@@ -316,7 +316,8 @@
(.lvf vf2 (&-> arg2 vec quad))
(.sub.vf vf4 vf0 vf0 :mask #b1000)
(.mul.vf vf3 vf1 vf2)
(.outer.product.vf vf4 vf1 vf2)
(.outer.product.a.vf acc vf1 vf2)
(.outer.product.b.vf vf4 vf2 vf1 acc)
(.mul.w.vf acc vf1 vf2)
(.add.mul.w.vf acc vf2 vf1 acc)
(.sub.mul.w.vf acc vf0 vf3 acc :mask #b1000)
@@ -409,9 +410,12 @@
(.sub.x.vf vf4 vf0 vf1 :mask #b10)
(.add.w.vf vf4 vf0 vf1 :mask #b100)
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
(.outer.product.vf vf2 vf5 vf2)
(.outer.product.vf vf3 vf5 vf3)
(.outer.product.vf vf4 vf5 vf4)
(.outer.product.a.vf acc vf5 vf2)
(.outer.product.b.vf vf2 vf2 vf5 acc)
(.outer.product.a.vf acc vf5 vf3)
(.outer.product.b.vf vf3 vf3 vf5 acc)
(.outer.product.a.vf acc vf5 vf4)
(.outer.product.b.vf vf4 vf4 vf5 acc)
(.add.w.vf vf2 vf2 vf0 :mask #b1)
(.add.w.vf vf3 vf3 vf0 :mask #b10)
(.add.w.vf vf4 vf4 vf0 :mask #b100)
@@ -723,8 +727,10 @@
(.sub.vf vf4 vf0 vf4 :mask #b110)
(.add.vf vf3 vf0 vf1 :mask #b111)
(.mul.x.vf vf3 vf0 vf2 :mask #b1000)
(.outer.product.vf vf6 vf0 vf0)
(.outer.product.vf vf5 vf0 vf0)
(.outer.product.a.vf acc vf1 vf1)
(.outer.product.b.vf vf6 vf0 vf0 acc)
(.outer.product.a.vf acc vf2 vf2)
(.outer.product.b.vf vf5 vf0 vf0 acc)
(.mul.x.vf vf6 vf0 vf6 :mask #b1000)
(.mul.x.vf vf5 vf0 vf5 :mask #b1000)
(.mul.vf acc vf6 vf4)
-6
View File
@@ -1121,12 +1121,6 @@
(process-entity-status! self (entity-perm-status bit-3) #t)
(none)
)
:exit
(behavior ()
(set! (-> self target) (the-as handle #f))
(process-entity-status! self (entity-perm-status bit-3) #f)
(none)
)
:trans
(behavior ()
(let ((gp-0 (handle->process (-> self target))))