_bmi_test.nx source
↩ module page · 14 lines · 489 B
1// Verify __clz32 + __ctz32 + __popcnt64 intrinsics.
2import "syscalls.nx"
3func main() -> i64 {
4 if __clz32(1) != 31 { return 11 }
5 if __clz32(0) != 32 { return 12 }
6 if __ctz32(1) != 0 { return 21 }
7 if __ctz32(8) != 3 { return 22 }
8 if __ctz32(0) != 32 { return 23 }
9 if __popcnt64(0) != 0 { return 31 }
10 if __popcnt64(0xFF) != 8 { return 32 }
11 if __popcnt64(0xFFFFFFFF) != 32 { return 33 }
12 if __popcnt64(0x1234567890ABCDEF) != 32 { return 34 }
13 return 0
14}