Fix the fix-round regression: the base matcher stripped any zext/trunc, so `(unsigned short)(unsigned)p + 24` lost its 16-bit truncation and became `p + 24` at both -O0 and -O2. stripWideningCasts now strips only zext/sext and truncs to at least the 32-bit pointer width; a trunc below i32 stops the match, leaving the shape unbarriered with its `and 0xffff`/`and 0xff` intact (the base commit's value). Allow widening sext on the base as well, closing the signed 64-bit pointer-int shape: `(char *)((long long)(int)p + 24)` now becomes `@__tms_bitptr(i32 24, ptr p)` instead of `getelementptr i8, p, 192`. Use the fixed 32-bit TMS34010 pointer width rather than an absent module DataLayout's 64-bit default, which misjudged a trunc to i32. Add @narrow16/@narrow8/@narrow16and/@late64s to bitptr.ll (narrow shapes must not emit a call), negative tests for the mismatched declaration, body and non-call use fatal paths, a late64s M0 check with the late positive scoped to @late itself, and narrow16/narrow8/late64s runtime markers plus IR checks in the M7 gate. Update the pointer-o2.sh header.
23 lines
723 B
NASM
23 lines
723 B
NASM
; pointer-entry.asm -- M7.1 pointer gate entry, linked at bit 018A0000.
|
|
;
|
|
; Sets the TI C field sizes, points STK/FP at the gate stack, calls the C
|
|
; driver pointer_run(), and writes a post-return sentinel. pointer-o2.sh
|
|
; concatenates the compiled driver after this file through scripts/m4/run.sh.
|
|
;
|
|
; Markers are at 018A8000 + n*0x20 bits (n = 0..12 written by the driver, n = 13
|
|
; the post-return sentinel); the copy bytes are at 018A9000 + n*8 bits.
|
|
.text
|
|
.globl _start
|
|
_start:
|
|
setf 16, 1, 0
|
|
setf 32, 0, 1
|
|
movi _cstack, a14
|
|
move a14, a13
|
|
calla _pointer_run
|
|
movi 5A5A5A5Ah, a0
|
|
movi 018A81A0h, a2 ; marker 13, the post-return sentinel
|
|
move a0, *a2, 1
|
|
rets
|
|
|
|
.bss _cstack, 32768, 16 ; 32768 bits = 4096 bytes
|