[OE-core] [PATCH 1/2] goarch.bbclass: Define HOST_GO386 and TARGET_GO386

Khem Raj raj.khem at gmail.com
Sat Oct 14 19:22:07 UTC 2017


On Sat, Oct 14, 2017 at 11:46 AM Paul Barker <pbarker at toganlabs.com> wrote:

> On Sat, Oct 14, 2017 at 2:22 AM, Khem Raj <raj.khem at gmail.com> wrote:
> > On Fri, Oct 13, 2017 at 12:25 PM, Paul Barker <pbarker at toganlabs.com>
> wrote:
> >> These variables are used to control the floating-point instructions
> emitted by
> >> the go compiler for x86 architectures.
> >>
> >> The default is '387' which disables the use of sse/sse2 instructions
> and is safe
> >> to use on all x86 processors from the i486 onwards.
> >>
> >> If TUNE_FEATURES contains a feature set which is known to support
> sse/sse2
> >> instructions then they are set to 'sse2' to enable the use of these
> >> instructions. This is suitable for most processors from Pentium 4
> onwards.
> >>
> >> Only the 'core2' and 'corei7' TUNE_FEATURES are defined in the oe-core
> layer and
> >> are known to support ss2 instructions. Other layers may introduce
> additional
> >> tunings which support sse2 instructions and for these layers,
> TARGET_GO386
> >> or go_map_386 should be overridden as needed.
> >>
> >> Signed-off-by: Paul Barker <pbarker at toganlabs.com>
> >> ---
> >>  meta/classes/goarch.bbclass | 11 +++++++++++
> >>  1 file changed, 11 insertions(+)
> >>
> >> diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
> >> index 659b26a..653f035 100644
> >> --- a/meta/classes/goarch.bbclass
> >> +++ b/meta/classes/goarch.bbclass
> >> @@ -4,10 +4,12 @@ BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
> >>  HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
> >>  HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
> >>  HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'),
> d.getVar('TUNE_FEATURES'), d)}"
> >> +HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'),
> d.getVar('TUNE_FEATURES'), d)}"
> >>  HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
> >>  TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
> >>  TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
> >>  TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'),
> d.getVar('TUNE_FEATURES'), d)}"
> >> +TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'),
> d.getVar('TUNE_FEATURES'), d)}"
> >>  TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
> >>  GO_BUILD_BINDIR =
> "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') ==
> d.getVar('HOST_GOTUPLE')]}"
> >>
> >> @@ -66,6 +68,15 @@ def go_map_arm(a, f, d):
> >>              return '5'
> >>      return ''
> >>
> >> +def go_map_386(a, f, d):
> >> +    import re
> >> +    if re.match('i.86', a):
> >> +        if ('core2' in f) or ('corei7' in f):
> >> +            return 'sse2'
> >> +        else:
> >> +            return '387'
> >> +    return ''
> >> +
> >
> >
> > This is too conservative IMO, e.g. anything above i586 is able to handle
> sse2
> > with this patch i686 will use x87 for FPU,
> >
>
> The Go documentation says "Pentium 4/Opteron/Athlon 64 or later"


Ok if it needs p4 then lets keep it so

>
> (https://golang.org/doc/install/source). GCC documentation also
> suggests that i686 is too early to support SSE2:
> https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options. So I
> think i686 should be using the old-style FPU instructions.
>
> Cheers,
>
> --
> Paul Barker
> Togán Labs Ltd
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20171014/44d8a673/attachment-0002.html>


More information about the Openembedded-core mailing list