summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2026-10-27 22:51:23 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2026-10-27 22:51:23 +0800
commit9af0ce286fac828f37747d78990b44f34b8b29b6 (patch)
tree7bf3e42efc00861ed9e4b561cc2e9db0b1e20fb0 /tools/lib/python
parentf4eeaa783e040443cc7fd8a926c4b148e95a3356 (diff)
LoongArch: Detect and expose DIV32 feature existence
The LoongArch Architecture Manual defines a hardware capability bit CPUCFG2_DIV32 (bit 26 of CPUCFG 0x2). When this bit is set to 1, it indicates that on 64-bit machines, the division and mod instructions (DIV.W[U] and MOD.W[U]) will ignore the upper 32 bits of the input registers and only compute based on the lower 32 bits. On certain CPU cores without this feature, these 32-bit instructions require both input operands to be properly sign-extended. Otherwise, the hardware execution results can be randomly meaningless values. Add the CPU_FEATURE_DIV32 definition, detect and export this hardware capability via elf_hwcap and cpu_has_div32 (in cpuinfo). This provides the infrastructure for subsystems like BPF JIT to safely choose either native 32-bit instructions or fallback instruction sequences based on the actual CPU hardware capabilities. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions