ref: 64e322cc776ca8c320796b5e7e1becccc240a13a
parent: 588c432ea9d25fb5b6820c10580f5364f8dbc9c1
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Dec 25 18:25:08 EST 2024
rename plan9_builtins → builtins_plan9 to follow a convention
--- /dev/null
+++ b/builtins_plan9.c
@@ -1,0 +1,11 @@
+#include "platform.h"
+
+int
+__builtin_clz(unsigned int x)
+{
+ unsigned int r;
+ if(x == 0)
+ return 32;
+ for(r = 0; (x & (1UL<<31)) == 0; x <<= 1, r++);
+ return r;
+}
--- /dev/null
+++ b/builtins_plan9_amd64.s
@@ -1,0 +1,4 @@
+TEXT __builtin_clz(SB),1,$0
+ BYTE $0x0F; BYTE $0xBD; BYTE $0xC5 /* BSRL RARG, AX */
+ XORL $31, AX
+ RET
--- /dev/null
+++ b/builtins_plan9_arm64.s
@@ -1,0 +1,3 @@
+TEXT __builtin_clz(SB),1,$0
+ CLZW R0, R0
+ RETURN
--- a/mkfile
+++ b/mkfile
@@ -19,6 +19,7 @@
3rd/wcwidth.$O\
bitvector.$O\
builtins.$O\
+ builtins_plan9`{test -f builtins_plan9_$objtype.s && echo -n _$objtype}.$O\
cvalues.$O\
equal.$O\
equalhash.$O\
@@ -32,7 +33,6 @@
main_plan9.$O\
opcodes.$O\
operators.$O\
- plan9_builtins`{test -f plan9_builtins_$objtype.s && echo -n _$objtype}.$O\
print.$O\
ptrhash.$O\
random.$O\
--- a/plan9_builtins.c
+++ /dev/null
@@ -1,11 +1,0 @@
-#include "platform.h"
-
-int
-__builtin_clz(unsigned int x)
-{
- unsigned int r;
- if(x == 0)
- return 32;
- for(r = 0; (x & (1UL<<31)) == 0; x <<= 1, r++);
- return r;
-}
--- a/plan9_builtins_amd64.s
+++ /dev/null
@@ -1,4 +1,0 @@
-TEXT __builtin_clz(SB),1,$0
- BYTE $0x0F; BYTE $0xBD; BYTE $0xC5 /* BSRL RARG, AX */
- XORL $31, AX
- RET
--- a/plan9_builtins_arm64.s
+++ /dev/null
@@ -1,3 +1,0 @@
-TEXT __builtin_clz(SB),1,$0
- CLZW R0, R0
- RETURN