How to use in method of x86 Package

Best Syzkaller code snippet using x86.in

x86_64_device.go

Source:x86_64_device.go Github

copy

Full Screen

1// Copyright 2015 Google Inc. All rights reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7// http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.14package config15import (16 "strings"17 "android/soong/android"18)19var (20 x86_64Cflags = []string{21 // Help catch common 32/64-bit errors.22 "-Werror=implicit-function-declaration",23 }24 x86_64Cppflags = []string{}25 x86_64Ldflags = []string{26 "-Wl,--hash-style=gnu",27 }28 x86_64Lldflags = ClangFilterUnknownLldflags(x86_64Ldflags)29 x86_64ArchVariantCflags = map[string][]string{30 "": []string{31 "-march=x86-64",32 },33 "broadwell": []string{34 "-march=broadwell",35 },36 "haswell": []string{37 "-march=core-avx2",38 },39 "ivybridge": []string{40 "-march=core-avx-i",41 },42 "sandybridge": []string{43 "-march=corei7",44 },45 "silvermont": []string{46 "-march=slm",47 },48 "skylake": []string{49 "-march=skylake",50 },51 "stoneyridge": []string{52 "-march=bdver4",53 },54 }55 x86_64ArchFeatureCflags = map[string][]string{56 "ssse3": []string{"-mssse3"},57 "sse4": []string{"-msse4"},58 "sse4_1": []string{"-msse4.1"},59 "sse4_2": []string{"-msse4.2"},60 // Not all cases there is performance gain by enabling -mavx -mavx261 // flags so these flags are not enabled by default.62 // if there is performance gain in individual library components,63 // the compiler flags can be set in corresponding bp files.64 // "avx": []string{"-mavx"},65 // "avx2": []string{"-mavx2"},66 // "avx512": []string{"-mavx512"}67 "popcnt": []string{"-mpopcnt"},68 "aes_ni": []string{"-maes"},69 }70)71const (72 x86_64GccVersion = "4.9"73)74func init() {75 android.RegisterDefaultArchVariantFeatures(android.Android, android.X86_64,76 "ssse3",77 "sse4",78 "sse4_1",79 "sse4_2",80 "popcnt")81 pctx.StaticVariable("x86_64GccVersion", x86_64GccVersion)82 pctx.SourcePathVariable("X86_64GccRoot",83 "prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${x86_64GccVersion}")84 pctx.StaticVariable("X86_64ToolchainCflags", "-m64")85 pctx.StaticVariable("X86_64ToolchainLdflags", "-m64")86 pctx.StaticVariable("X86_64Ldflags", strings.Join(x86_64Ldflags, " "))87 pctx.StaticVariable("X86_64Lldflags", strings.Join(x86_64Lldflags, " "))88 pctx.StaticVariable("X86_64IncludeFlags", bionicHeaders("x86"))89 // Clang cflags90 pctx.StaticVariable("X86_64ClangCflags", strings.Join(ClangFilterUnknownCflags(x86_64Cflags), " "))91 pctx.StaticVariable("X86_64ClangLdflags", strings.Join(ClangFilterUnknownCflags(x86_64Ldflags), " "))92 pctx.StaticVariable("X86_64ClangLldflags", strings.Join(ClangFilterUnknownCflags(x86_64Lldflags), " "))93 pctx.StaticVariable("X86_64ClangCppflags", strings.Join(ClangFilterUnknownCflags(x86_64Cppflags), " "))94 // Yasm flags95 pctx.StaticVariable("X86_64YasmFlags", "-f elf64 -m amd64")96 // Extended cflags97 // Architecture variant cflags98 for variant, cflags := range x86_64ArchVariantCflags {99 pctx.StaticVariable("X86_64"+variant+"VariantClangCflags",100 strings.Join(ClangFilterUnknownCflags(cflags), " "))101 }102}103type toolchainX86_64 struct {104 toolchain64Bit105 toolchainClangCflags string106}107func (t *toolchainX86_64) Name() string {108 return "x86_64"109}110func (t *toolchainX86_64) GccRoot() string {111 return "${config.X86_64GccRoot}"112}113func (t *toolchainX86_64) GccTriple() string {114 return "x86_64-linux-android"115}116func (t *toolchainX86_64) GccVersion() string {117 return x86_64GccVersion118}119func (t *toolchainX86_64) IncludeFlags() string {120 return "${config.X86_64IncludeFlags}"121}122func (t *toolchainX86_64) ClangTriple() string {123 return t.GccTriple()124}125func (t *toolchainX86_64) ToolchainClangLdflags() string {126 return "${config.X86_64ToolchainLdflags}"127}128func (t *toolchainX86_64) ToolchainClangCflags() string {129 return t.toolchainClangCflags130}131func (t *toolchainX86_64) ClangCflags() string {132 return "${config.X86_64ClangCflags}"133}134func (t *toolchainX86_64) ClangCppflags() string {135 return "${config.X86_64ClangCppflags}"136}137func (t *toolchainX86_64) ClangLdflags() string {138 return "${config.X86_64Ldflags}"139}140func (t *toolchainX86_64) ClangLldflags() string {141 return "${config.X86_64Lldflags}"142}143func (t *toolchainX86_64) YasmFlags() string {144 return "${config.X86_64YasmFlags}"145}146func (toolchainX86_64) LibclangRuntimeLibraryArch() string {147 return "x86_64"148}149func x86_64ToolchainFactory(arch android.Arch) Toolchain {150 toolchainClangCflags := []string{151 "${config.X86_64ToolchainCflags}",152 "${config.X86_64" + arch.ArchVariant + "VariantClangCflags}",153 }154 for _, feature := range arch.ArchFeatures {155 toolchainClangCflags = append(toolchainClangCflags, x86_64ArchFeatureCflags[feature]...)156 }157 return &toolchainX86_64{158 toolchainClangCflags: strings.Join(toolchainClangCflags, " "),159 }160}161func init() {162 registerToolchainFactory(android.Android, android.X86_64, x86_64ToolchainFactory)163}...

Full Screen

Full Screen

cpu_x86.go

Source:cpu_x86.go Github

copy

Full Screen

1// Copyright 2017 The Go Authors. All rights reserved.2// Use of this source code is governed by a BSD-style3// license that can be found in the LICENSE file.4// +build 386 amd64 amd64p325package cpu6const CacheLineSize = 647// cpuid is implemented in cpu_x86.s.8func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32)9// xgetbv with ecx = 0 is implemented in cpu_x86.s.10func xgetbv() (eax, edx uint32)11func init() {12 maxID, _, _, _ := cpuid(0, 0)13 if maxID < 1 {14 return15 }16 _, _, ecx1, edx1 := cpuid(1, 0)17 X86.HasSSE2 = isSet(26, edx1)18 X86.HasSSE3 = isSet(0, ecx1)19 X86.HasPCLMULQDQ = isSet(1, ecx1)20 X86.HasSSSE3 = isSet(9, ecx1)21 X86.HasFMA = isSet(12, ecx1)22 X86.HasSSE41 = isSet(19, ecx1)23 X86.HasSSE42 = isSet(20, ecx1)24 X86.HasPOPCNT = isSet(23, ecx1)25 X86.HasAES = isSet(25, ecx1)26 X86.HasOSXSAVE = isSet(27, ecx1)27 osSupportsAVX := false28 // For XGETBV, OSXSAVE bit is required and sufficient.29 if X86.HasOSXSAVE {30 eax, _ := xgetbv()31 // Check if XMM and YMM registers have OS support.32 osSupportsAVX = isSet(1, eax) && isSet(2, eax)33 }34 X86.HasAVX = isSet(28, ecx1) && osSupportsAVX35 if maxID < 7 {36 return37 }38 _, ebx7, _, _ := cpuid(7, 0)39 X86.HasBMI1 = isSet(3, ebx7)40 X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX41 X86.HasBMI2 = isSet(8, ebx7)42 X86.HasERMS = isSet(9, ebx7)43 X86.HasADX = isSet(19, ebx7)44}45func isSet(bitpos uint, value uint32) bool {46 return value&(1<<bitpos) != 047}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful