[PATCH] [AArch64] Add -mgeneral_regs_only option

Amara Emerson amara.emerson at arm.com
Fri Jan 24 08:46:45 PST 2014


Hmm that's a good point. Do you have any ideas on how to handle this in the backend? I've been trying to think of a way to prevent generation of FP instructions in a more fine grained way, but still error in the right cases. For example, since there is *no* soft-float ABI for AArch64, the current implementation shouldn't allow users to use floating point operations via libcalls, but it unfortunately does.

Amara

> -----Original Message-----
> From: Tim Northover [mailto:t.p.northover at gmail.com]
> Sent: 24 January 2014 16:24
> To: Amara Emerson
> Cc: Bernard Ogden; reviews+D2586+public+4d171e861f82b113 at llvm-
> reviews.chandlerc.com; cfe-commits at cs.uiuc.edu
> Subject: Re: [PATCH] [AArch64] Add -mgeneral_regs_only option
> 
> > I think that should be an error.
> 
> I disagree. If someone wants to pretend their CPU doesn't have
> floating point registers entirely, that's what -march is for. This
> option says that it's constraining the compiler.
> 
> Also, people usually want this so that they *can* use floating point
> registers under strict controls. For example in kernels to save
> FP-context only when necessary.
> 
> There's no way to do this with the behaviour you're proposing (short
> of a completely separate .S file under complete user control): as soon
> as the -mgeneral_regs_only option is removed LLVM has permission to
> throw them around with gay abandon and any inline asm you use might
> (potentially) see corrupted values produce them.
> 
> > GCC throws an error if you try to use
> > floating point types with -mgeneral-regs-only, so inline assembly
> wouldn't work anyway.
> 
> You don't have to use floating-point types to use FP values in inline
> asm. A simple context-save block might just depend on a "char *" at
> the C level, for example:
> 
>     asm("stp q0, q1, [%0]" : : "r"(&process->fp_regs) : "memory");
> 
> Cheers.
> 
> Tim.








More information about the cfe-commits mailing list