Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/xor: Improve inline assembly constraints

The inline assembly constraint for the "bytes" operand is "d" for all xor()
inline assemblies. "d" means that any register from 0 to 15 can be used. If
the compiler would use register 0 then the exrl instruction would not or
the value of "bytes" into the executed instruction - resulting in an
incorrect result.

However all the xor() inline assemblies make hard-coded use of register 0,
and it is correctly listed in the clobber list, so that this cannot happen.

Given that this is quite subtle use the better "a" constraint, which
excludes register 0 from register allocation in any case.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20260302133500.1560531-3-hca@linux.ibm.com
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
87ff6da3 f775276e

+4 -4
+4 -4
arch/s390/lib/xor.c
··· 28 28 " j 3f\n" 29 29 "2: xc 0(1,%1),0(%2)\n" 30 30 "3:" 31 - : "+d" (bytes), "+a" (p1), "+a" (p2) 31 + : "+a" (bytes), "+a" (p1), "+a" (p2) 32 32 : : "0", "cc", "memory"); 33 33 } 34 34 ··· 54 54 "2: xc 0(1,%1),0(%2)\n" 55 55 "3: xc 0(1,%1),0(%3)\n" 56 56 "4:" 57 - : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3) 57 + : "+a" (bytes), "+a" (p1), "+a" (p2), "+a" (p3) 58 58 : : "0", "cc", "memory"); 59 59 } 60 60 ··· 85 85 "3: xc 0(1,%1),0(%3)\n" 86 86 "4: xc 0(1,%1),0(%4)\n" 87 87 "5:" 88 - : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4) 88 + : "+a" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4) 89 89 : : "0", "cc", "memory"); 90 90 } 91 91 ··· 121 121 "4: xc 0(1,%1),0(%4)\n" 122 122 "5: xc 0(1,%1),0(%5)\n" 123 123 "6:" 124 - : "+d" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4), 124 + : "+a" (bytes), "+a" (p1), "+a" (p2), "+a" (p3), "+a" (p4), 125 125 "+a" (p5) 126 126 : : "0", "cc", "memory"); 127 127 }