luau/CodeGen/src
Arseny Kapoulkine 80928acb92
CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171)
Instead of patching the tag component with TVECTOR in every instruction
that produces a vector value, we now use a separate IR instruction to do
this. This reduces implementation redundancy, but more importantly
allows for a class of optimizations:

- NUM_TO_VECTOR previously patched the component unconditionally but the
result was used only in MUL/DIV_VEC instructions that ignore it anyway;
we can now remove this.

- ADD_VEC et al can now forward the source of TAG_VECTOR instruction of
either input; this shortens the latency chain and in the future could
allow us to generate optimal vector instruction sequence once the
temporary stores are marked as dead.

- In the future on X64, ADD_VEC et al will be able to analyze the input
instruction and remove tag masking conditionally. This is not part of
this PR as it requires a decision around expected FP environment and/or
the necessity of the existing masking to begin with.

I've also renamed NUM_TO_VECTOR to NUM_TO_VEC so that "VEC" always
refers to "3 float values" and for consistency with ADD/etc.

Note: ADD_VEC input forwarding is currently performed unconditionally;
it may or may not increase the spills that can't be reloaded from the
stack.

On A64 this makes the Taylor series computation a tiny bit faster
(11.3ns => 11.0ns) as it removes the redundant ins instructions along
the NUM_TO_VEC path. Curiously, the optimization of forwarding
TAG_VECTOR input to arithmetic instructions actually has a small penalty
as without it this PR runs at 10.9 ns. I don't know if this is a
property of the benchmark though, as I just noticed that in this
benchmark type inference actually fails to infer parts of the
computation as a vector op. If desired I will happily omit this part of
the change and we can explore that separately.
2024-02-21 07:06:11 -08:00
..
AssemblyBuilderA64.cpp Improve A64 lowering for vector operations by using vector instructions (#1164) 2024-02-16 08:30:35 -08:00
AssemblyBuilderX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
BitUtils.h Sync to upstream/release/574 (#910) 2023-04-28 12:55:13 -07:00
BytecodeAnalysis.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
BytecodeSummary.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
ByteUtils.h Sync to upstream/release/603 (#1097) 2023-11-10 13:10:07 -08:00
CodeAllocator.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeBlockUnwind.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGen.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGenA64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGenA64.h Sync to upstream/release/572 (#899) 2023-04-14 11:06:22 -07:00
CodeGenAssembly.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGenLower.h Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGenUtils.cpp Add tagged lightuserdata (#1087) 2023-12-14 15:05:51 -08:00
CodeGenUtils.h Sync to upstream/release/602 (#1089) 2023-11-03 16:45:04 -07:00
CodeGenX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
CodeGenX64.h Sync to upstream/release/572 (#899) 2023-04-14 11:06:22 -07:00
EmitBuiltinsX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
EmitBuiltinsX64.h Sync to upstream/release/574 (#910) 2023-04-28 12:55:13 -07:00
EmitCommon.h Sync to upstream/release/606 (#1127) 2023-12-08 13:50:16 -08:00
EmitCommonA64.h Sync to upstream/release/591 (#1012) 2023-08-18 11:15:41 -07:00
EmitCommonX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
EmitCommonX64.h Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
EmitInstructionX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
EmitInstructionX64.h Sync to upstream/release/592 (#1018) 2023-08-25 10:23:55 -07:00
IrAnalysis.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrBuilder.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrCallWrapperX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrDump.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
IrLoweringA64.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
IrLoweringA64.h Sync to upstream/release/603 (#1097) 2023-11-10 13:10:07 -08:00
IrLoweringX64.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
IrLoweringX64.h Sync to upstream/release/610 (#1154) 2024-01-26 19:20:56 -08:00
IrRegAllocA64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrRegAllocA64.h Sync to upstream/release/595 (#1044) 2023-09-15 10:26:59 -07:00
IrRegAllocX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrTranslateBuiltins.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrTranslateBuiltins.h Sync to upstream/release/584 (#977) 2023-07-14 11:08:53 -07:00
IrTranslation.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
IrTranslation.h Sync to upstream/release/605 (#1118) 2023-12-01 23:46:57 -08:00
IrUtils.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
IrValueLocationTracking.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
IrValueLocationTracking.h Sync to upstream/release/596 (#1050) 2023-09-22 12:12:15 -07:00
lcodegen.cpp Add CodeGen C API (#931) 2023-05-18 04:03:29 -07:00
NativeState.cpp Sync to upstream/release/602 (#1089) 2023-11-03 16:45:04 -07:00
NativeState.h Sync to upstream/release/602 (#1089) 2023-11-03 16:45:04 -07:00
OptimizeConstProp.cpp CodeGen: Extract all vector tag patching into TAG_VECTOR (#1171) 2024-02-21 07:06:11 -08:00
OptimizeFinalX64.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
UnwindBuilderDwarf2.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00
UnwindBuilderWin.cpp Sync to upstream/release/613 (#1167) 2024-02-15 18:04:39 -08:00