I guess I get it. You want your use of the "cpu" directive to set "__CPU__", right? Sort of (but not exactly) like this?
bits 32
%macro setcpu 1
cpu %1
%define __CPU__ %1
%endmacro
%macro bswap 1
%ifidn __CPU__, 386
; placeholder - "generic" bswap is hard!
;mov eax, ~(1<<31) ; just to "make a (bogus) noise"
; testing nasm64developer's "fix"
mov eax, 0FFFFFFFFh & ( ~(1<<31)) ; no noise
nop
%elifidn __CPU__, 486
bswap %1
%else
%warning "not implemented for this cpu level"
%endif
%endmacro
setcpu 386
bswap eax
setcpu 486
bswap eax
Ideally, "__CPU__" would be numeric, not text like this humble example, so we could use "<", ">", etc... I guess that could be done... You can make a "feature request" at SF, but don't hold your breath waiting for it. Meantime, perhaps a slightly more sophisticated macro could be worked up. Too hot to chase women today, maybe I'll get to it...
Best,
Frank