[PATCH][GCC][AArch64] Fix subreg bug in scalar copysign

Tamar Christina Tamar.Christina@arm.com
Wed Mar 15 16:04:00 GMT 2017


Hi All, 

This fixes a bug in the scalar version of copysign where due to a subreg
were generating less than efficient code.

This patch replaces

  return x * __builtin_copysignf (150.0f, y);

which used to generate

	adrp	x1, .LC1
	mov	x0, 2147483648
	ins	v3.d[0], x0
	ldr	s2, [x1, #:lo12:.LC1]
	bsl	v3.8b, v1.8b, v2.8b
	fmul	s0, s0, s3
	ret

.LC1:
	.word	1125515264

with
	mov	x0, 1125515264
	movi	v2.2s, 0x80, lsl 24
	fmov	d3, x0
	bit	v3.8b, v1.8b, v2.8b
	fmul	s0, s0, s3
	ret

removing the incorrect ins.

Regression tested on aarch64-none-linux-gnu and no regressions.

OK for trunk?

Thanks,
Tamar

gcc/
2017-03-15  Tamar Christina  <tamar.christina@arm.com>

	* config/aarch64/aarch64.md
	(copysignsf3): Fix mask generation.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scalar-copysign.patch
Type: text/x-patch
Size: 1104 bytes
Desc: scalar-copysign.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170315/9d29d2d1/attachment.bin>


More information about the Gcc-patches mailing list