Files
betterxen/scripts/assemble-fixture.sh
T
elforeign 3221f0e333 isa, decoder, shader, ref: the eight SOP2 64-bit logical forms through the semantic registry (#215)
s_and_b64, s_or_b64, s_xor_b64, s_andn2_b64, s_orn2_b64, s_nand_b64,
s_nor_b64 and s_xnor_b64 share one shape: an even-aligned SGPR pair
destination, two 64-bit sources and SCC = (D != 0). This adds the 64-bit
scalar vocabulary they need: an operand rule for even SGPR pairs and
64-bit inline constants and literals (the pinned XML declares the
sources FMT_NUM_U64, so a 32-bit literal is zero-extended), width-64
generator support, 64-bit primitives, decoder, compile-time evaluation on
SGPR pairs and both reference interpreters.

An independent oracle (tests/validation/tests/sop2_b64.rs) checks 4,432
cases and 2,608 rejected programs on both CPU interpreters and, through
the translator, on native Metal. EXEC, VCC, M0, TTMP and special operands
stay rejected. The 64-bit shifts and bit-field forms are left for later.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
2026-11-24 09:44:30 -06:00

25 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
set -eu
cd "$(dirname "$0")/.."
llvm_bin=${LLVM_BIN:-$(brew --prefix llvm)/bin}
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
case "${1:-}" in
--check|"") ;;
*) printf '%s\n' 'usage: scripts/assemble-fixture.sh [--check]' >&2; exit 2 ;;
esac
for name in add bitwise-branch float-exact or shifts ashr \
x9-constant-vs x9-constant-ps x9-varying-vs x9-varying-ps x9-transform-vs scalar-alu vector-compare scalar-logic scalar-logic-b64 scalar-compare scalar-unary scalar-arith scalar-immediate vector-integer vector-compare-ft; do
"$llvm_bin/llvm-mc" -triple=amdgcn-amd-amdhsa -mcpu=gfx1030 -mattr=+wavefrontsize32 \
-filetype=obj "fixtures/rdna2/$name.s" -o "$scratch/$name.o"
"$llvm_bin/llvm-objcopy" -O binary --only-section=.text "$scratch/$name.o" "$scratch/$name.bin"
if [ "${1:-}" = --check ]; then
cmp "$scratch/$name.bin" "fixtures/rdna2/$name.bin"
else
cp "$scratch/$name.bin" "fixtures/rdna2/$name.bin"
fi
done