Explicit binary op order for both gcc and clang/llvm.
* gcc assembler parses (1 << n - 1) as ((1 << n) - 1)
* llvm assembler parses (1 << n - 1) as (1 << (n - 1))
BUG: 26289334
Change-Id: Iaaa3d07f59c0f87cb1b80b9a1c4e765b66846791
diff --git a/libc/arch-x86/atom/string/sse2-strrchr-atom.S b/libc/arch-x86/atom/string/sse2-strrchr-atom.S
index da3dc3b..e916bc1 100644
--- a/libc/arch-x86/atom/string/sse2-strrchr-atom.S
+++ b/libc/arch-x86/atom/string/sse2-strrchr-atom.S
@@ -278,7 +278,7 @@
jnz L(FindZeroExit2)
test $0x04, %cl
jnz L(FindZeroExit3)
- and $1 << 4 - 1, %eax
+ and $(1 << 4) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -296,7 +296,7 @@
jnz L(FindZeroExit6)
test $0x40, %cl
jnz L(FindZeroExit7)
- and $1 << 8 - 1, %eax
+ and $(1 << 8) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -317,7 +317,7 @@
jnz L(FindZeroExit10)
test $0x04, %ch
jnz L(FindZeroExit11)
- and $1 << 12 - 1, %eax
+ and $(1 << 12) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -335,7 +335,7 @@
jnz L(FindZeroExit14)
test $0x40, %ch
jnz L(FindZeroExit15)
- and $1 << 16 - 1, %eax
+ and $(1 << 16) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -359,7 +359,7 @@
.p2align 4
L(FindZeroExit2):
- and $1 << 2 - 1, %eax
+ and $(1 << 2) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -371,7 +371,7 @@
.p2align 4
L(FindZeroExit3):
- and $1 << 3 - 1, %eax
+ and $(1 << 3) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -383,7 +383,7 @@
.p2align 4
L(FindZeroExit5):
- and $1 << 5 - 1, %eax
+ and $(1 << 5) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -395,7 +395,7 @@
.p2align 4
L(FindZeroExit6):
- and $1 << 6 - 1, %eax
+ and $(1 << 6) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -407,7 +407,7 @@
.p2align 4
L(FindZeroExit7):
- and $1 << 7 - 1, %eax
+ and $(1 << 7) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -419,7 +419,7 @@
.p2align 4
L(FindZeroExit9):
- and $1 << 9 - 1, %eax
+ and $(1 << 9) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -431,7 +431,7 @@
.p2align 4
L(FindZeroExit10):
- and $1 << 10 - 1, %eax
+ and $(1 << 10) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -443,7 +443,7 @@
.p2align 4
L(FindZeroExit11):
- and $1 << 11 - 1, %eax
+ and $(1 << 11) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -455,7 +455,7 @@
.p2align 4
L(FindZeroExit13):
- and $1 << 13 - 1, %eax
+ and $(1 << 13) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -467,7 +467,7 @@
.p2align 4
L(FindZeroExit14):
- and $1 << 14 - 1, %eax
+ and $(1 << 14) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -479,7 +479,7 @@
.p2align 4
L(FindZeroExit15):
- and $1 << 15 - 1, %eax
+ and $(1 << 15) - 1, %eax
jz L(return_value)
POP (%ebx)
@@ -619,7 +619,7 @@
jnz L(PrologFindZeroExit2)
test $0x04, %cl
jnz L(PrologFindZeroExit3)
- and $1 << 4 - 1, %eax
+ and $(1 << 4) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
@@ -632,7 +632,7 @@
jnz L(PrologFindZeroExit6)
test $0x40, %cl
jnz L(PrologFindZeroExit7)
- and $1 << 8 - 1, %eax
+ and $(1 << 8) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
@@ -648,7 +648,7 @@
jnz L(PrologFindZeroExit10)
test $0x04, %ch
jnz L(PrologFindZeroExit11)
- and $1 << 12 - 1, %eax
+ and $(1 << 12) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
@@ -661,7 +661,7 @@
jnz L(PrologFindZeroExit14)
test $0x40, %ch
jnz L(PrologFindZeroExit15)
- and $1 << 16 - 1, %eax
+ and $(1 << 16) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
@@ -675,77 +675,77 @@
.p2align 4
L(PrologFindZeroExit2):
- and $1 << 2 - 1, %eax
+ and $(1 << 2) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit3):
- and $1 << 3 - 1, %eax
+ and $(1 << 3) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit5):
- and $1 << 5 - 1, %eax
+ and $(1 << 5) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit6):
- and $1 << 6 - 1, %eax
+ and $(1 << 6) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit7):
- and $1 << 7 - 1, %eax
+ and $(1 << 7) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit9):
- and $1 << 9 - 1, %eax
+ and $(1 << 9) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit10):
- and $1 << 10 - 1, %eax
+ and $(1 << 10) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit11):
- and $1 << 11 - 1, %eax
+ and $(1 << 11) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit13):
- and $1 << 13 - 1, %eax
+ and $(1 << 13) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit14):
- and $1 << 14 - 1, %eax
+ and $(1 << 14) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
.p2align 4
L(PrologFindZeroExit15):
- and $1 << 15 - 1, %eax
+ and $(1 << 15) - 1, %eax
jnz L(match_case1)
xor %eax, %eax
RETURN
diff --git a/libc/arch-x86/atom/string/sse2-wcsrchr-atom.S b/libc/arch-x86/atom/string/sse2-wcsrchr-atom.S
index e30779d..1a55df2 100644
--- a/libc/arch-x86/atom/string/sse2-wcsrchr-atom.S
+++ b/libc/arch-x86/atom/string/sse2-wcsrchr-atom.S
@@ -280,7 +280,7 @@
.p2align 4
L(find_zero_in_second_wchar):
- and $1 << 5 - 1, %eax
+ and $(1 << 5) - 1, %eax
jz L(return_value)
POP (%esi)
@@ -296,7 +296,7 @@
L(find_zero_in_third_or_fourth_wchar):
test $15, %ch
jz L(find_zero_in_fourth_wchar)
- and $1 << 9 - 1, %eax
+ and $(1 << 9) - 1, %eax
jz L(return_value)
POP (%esi)
@@ -368,7 +368,7 @@
.p2align 4
L(prolog_find_zero_in_second_wchar):
- and $1 << 5 - 1, %eax
+ and $(1 << 5) - 1, %eax
jz L(return_null)
test $15 << 4, %al
@@ -380,7 +380,7 @@
L(prolog_find_zero_in_third_or_fourth_wchar):
test $15, %ch
jz L(prolog_find_zero_in_fourth_wchar)
- and $1 << 9 - 1, %eax
+ and $(1 << 9) - 1, %eax
jz L(return_null)
test %ah, %ah