Skip to content

Instantly share code, notes, and snippets.

@iains
Last active October 9, 2023 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iains/dd71f6ae4ebe3236ef1593082e267326 to your computer and use it in GitHub Desktop.
Save iains/dd71f6ae4ebe3236ef1593082e267326 to your computer and use it in GitHub Desktop.
xorsign question
for this (and three other) functions in this test Darwin's port is producing very different code from linux (and it's not especially obvious to me why it would, since I've not [at least inentionally] modified any vector stuff):
EDIT: explanation is that the Linux long double is 128 bit, where the Darwin ABI has long double same as double.
long double
check_l_pos (long double x, long double y)
{
return x * __builtin_copysignl (1.0, y);
}
Darwin aarch64 port;
lC0:
.xword -9223372036854775808
.xword -9223372036854775808
.globl _check_l_pos
_check_l_pos:
adrp x0, lC0@PAGE
ldr q31, [x0, #lC0@PAGEOFF]
and v31.16b, v31.16b, v1.16b
eor v0.16b, v31.16b, v0.16b
ret
aarch64-none-linux-gnu:
.LC1:
.word 0
.word 0
.word 0
.word 1073676288
.LC2:
.word 0
.word 0
.word 0
.word -1073807360
.global __multf3
.align 2
.align 4
.global check_l_pos
.type check_l_pos, %function
check_l_pos:
stp x29, x30, [sp, -32]!
adrp x0, .LC1
add x0, x0, :lo12:.LC1
mov x29, sp
str q1, [sp, 16]
mov v1.16b, v0.16b
ldr q0, [x0]
ldr x0, [sp, 24]
tbz x0, #63, .L5
adrp x0, .LC2
add x0, x0, :lo12:.LC2
ldr q0, [x0]
.L5:
bl __multf3
ldp x29, x30, [sp], 32
ret
====
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment