Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2012 20:45:56 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        "Thomas D. Dean" <tomdean@speakeasy.org>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: Gcc46 and 128 Bit Floating Point
Message-ID:  <20120229044556.GA29229@troutmask.apl.washington.edu>
In-Reply-To: <4F4DA398.6070703@speakeasy.org>
References:  <4F3EA37F.9010207@speakeasy.org> <CAGE5yCpvF0-b1iKAVGbya=fUNaYbGyrpj1PHSQxw4BvycNMLDg@mail.gmail.com> <4F3EC0B4.6050107@speakeasy.org> <4F4DA398.6070703@speakeasy.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 28, 2012 at 08:03:36PM -0800, Thomas D. Dean wrote:
> On 02/17/12 13:03, Thomas D. Dean wrote:
> 
> Or, am I missing something?

I think the answer to you question is 'maybe'.

> #include <quadmath.h>
> #include <stdio.h>
> int main() {
>   char buf[128];
>   __float128 x = sqrtq(2.0Q);
>   quadmath_snprintf(buf, sizeof buf, "%.45Qf",x);
>   printf("sin(%s) = ",buf);
>   quadmath_snprintf(buf, sizeof buf, "%.45Qf",sinq(x));
>   printf("%s\n",buf);
>   return 0;
> }
> 
> gcc46 math.c -o math /usr/local/lib/gcc46/libquadmath.a /usr/lib/libm.a

You probably want to add -O here.

> Looking at the output of objdump -d math shows software implementation 
> of sqrtq() and sinq().  gcc46 does use the fsqrt instruction but not fsin.

Huh?  gcc46 -S gives


	.file	"a.c"
	.section	.rodata
.LC1:
	.string	"%.45Qf"
.LC2:
	.string	"sin(%s) = "
	.text
	.globl	main
	.type	main, @function
main:
.LFB4:
	.cfi_startproc
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$144, %rsp
	movdqa	.LC0(%rip), %xmm0
	call	sqrtq
	movdqa	%xmm0, -16(%rbp)
	movdqa	-16(%rbp), %xmm0
	leaq	-144(%rbp), %rax
	movl	$.LC1, %edx
	movl	$128, %esi
	movq	%rax, %rdi
	movl	$1, %eax
	call	quadmath_snprintf
	leaq	-144(%rbp), %rax
	movq	%rax, %rsi
	movl	$.LC2, %edi
	movl	$0, %eax
	call	printf
	movdqa	-16(%rbp), %xmm0
	call	sinq
	leaq	-144(%rbp), %rax
	movl	$.LC1, %edx
	movl	$128, %esi
	movq	%rax, %rdi
	movl	$1, %eax
	call	quadmath_snprintf
	leaq	-144(%rbp), %rax
	movq	%rax, %rdi
	call	puts
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	main, .-main
	.section	.rodata
	.align 16
.LC0:
	.long	0
	.long	0
	.long	0
	.long	1073741824
	.ident	"GCC: (FreeBSD Ports Collection) 4.6.2"

I don't see fsqrt.

-- 
Steve



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120229044556.GA29229>