skills_all/ispc-lit-tests/SKILL.md
Best practices for creating ISPC lit tests. Use when writing regression tests, verifying code generation, or checking compiler diagnostics.
npx skillsauth add activer007/ordinary-claude-skills ispc-lit-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A concise guide for writing lit tests for the ISPC. These tests ensure compiler correctness, verify generated code, and prevent regressions.
Use lit tests when validating:
--nowrapPrevents line wrapping in compiler output for consistent FileCheck matching:
// RUN: %{ispc} %s --target=host --nowrap --emit-llvm-text -o - | FileCheck %s
--nostdlib When Not Testing Library CodeSimplifies test output and avoids unrelated symbols:
// RUN: %{ispc} %s --target=host --nostdlib --nowrap -o - | FileCheck %s
export Unless Testing Itexport functions generate both masked and unmasked IR — doubling the verification effort.
// Preferred
void foo() { ... }
// Avoid unless explicitly testing export behavior
export void foo() { ... }
Use --target=host unless verifying target-specific codegen:
// RUN: %{ispc} %s --target=host --nowrap -o - | FileCheck %s
Avoid hardcoding vector widths or variable names.
Use named patterns like [[WIDTH]] and [[TYPE]].
Example:
// CHECK-NEXT: %test = sdiv <[[WIDTH:.*]] x i32> %a, %b
// CHECK-NEXT: ret <[[WIDTH]] x i32> %test
When order is flexible:
// CHECK-DAG: {{%.*}} = shufflevector <[[WIDTH:.*]] x [[BASE_TYPE:i.*]]> {{%.*}}, <[[WIDTH]] x [[BASE_TYPE]]> {{poison|undef}}, <[[WIDTH]] x [[BASE_TYPE]]> zeroinitializer
Tip: Avoid relying on exact variable names — they differ between OS and LLVM versions.
When output differs by architecture or ISA:
REQUIRES: directive for conditional execution.Example:
// RUN: %{ispc} %s --target=avx512skx-x16 --emit-asm -o - | FileCheck %s
// REQUIRES: X86_ENABLED
REQUIRES for Feature DependenciesDefined in tests/lit-tests/lit.cfg:
X86_ENABLED, LLVM_*_0+, etc.%{ispc}, %s, %tUse --debug-phase to capture output of specific optimization passes:
// RUN: %{ispc} %s --target=avx2 --emit-llvm-text \
// RUN: --debug-phase=325:325 --dump-file=%t -o /dev/null
// RUN: FileCheck --input-file %t/ir_325_LoadStoreVectorizerPass.ll %s
Clearly describe what the test verifies and why it exists.
Example:
// Verifies that stmxcsr/ldmxcsr intrinsics correctly set/restore FTZ/DAZ flags
// when --opt=reset-ftz-daz is enabled.
// Brief description of the test purpose
// RUN: %{ispc} %s --target=host --nostdlib --nowrap --emit-llvm-text -o - | FileCheck %s
// REQUIRES: <feature_if_needed>
// CHECK-LABEL: @function_name___
// CHECK: expected pattern
// CHECK-NOT: unexpected pattern
void function_name() {
// Minimal reproducible test code here
}
Run all lit tests:
cmake --build build --target check-all -j $(nproc)
To test the specific test, run:
TEST=/full/path/test.ispc cmake --build build --target check-one -j $(nproc)
####.ispc, where #### is the GitHub issue number.feature-name-1.ispc, feature-name-2.ispc).tools
Generate typed TypeScript SDKs for AI agents to interact with MCP servers. Converts verbose JSON-RPC curl commands to clean function calls (docs.createDocument() vs curl). Auto-detects MCP tools from server modules, generates TypeScript types and client methods, creates runnable example scripts. Use when: building MCP-enabled applications, need typed programmatic access to MCP tools, want Claude Code to manage apps via scripts, eliminating manual JSON-RPC curl commands, validating MCP inputs/outputs, or creating reusable agent automation.
testing
Generate structured task lists from specs or requirements. IMPORTANT: After completing ANY spec via ExitSpecMode, ALWAYS ask the user: "Would you like me to generate a task list for this spec?" Use when user confirms or explicitly requests task generation from a plan/spec/PRD.
tools
Create compelling story-format summaries using UltraThink to find the best narrative framing. Support multiple formats - 3-part narrative, n-length with inline links, abridged 5-line, or comprehensive via Foundry MCP. USE WHEN user says 'create story explanation', 'narrative summary', 'explain as a story', or wants content in Daniel's conversational first-person voice.
testing
Navigate through the original three-world shamanic technology. Deploy when soul retrieval, power animal guidance, or journey between realms emerges. Deeply respectful of Tungus, Buryat, Yakut, Evenki traditions. Use for consciousness navigation, NOT cultural appropriation.