enc_both(base.fill.f64, r.ffillSib32, 0xf2, 0x0f, 0x10) enc_both(base.regfill.f64, r.fregfill32, 0xf2, 0x0f, 0x10) enc_both(base.spill.f32, r.fspillSib32, 0xf3, 0x0f, 0x11) enc_both(base.regspill.f32, r.fregspill32, 0xf3, 0x0f, 0x11) enc_both(base.spill.f64, r.fspillSib32, 0xf2, 0x0f, 0x11) enc_both(base.regspill.f64, r.fregspill32, 0xf2, 0x0f, 0x11) # # Function addresses. # # Non-PIC, all-ones funcaddresses. X86_32.enc(base.func_addr.i32, *r.fnaddr4(0xb8), isap=And(Not(allones_funcaddrs), Not(is_pic))) X86_64.enc(base.func_addr.i64, *r.fnaddr8.rex(0xb8, w=1), isap=And(Not(allones_funcaddrs), Not(is_pic))) # Non-PIC, all-zeros funcaddresses. X86_32.enc(base.func_addr.i32, *r.allones_fnaddr4(0xb8), isap=And(allones_funcaddrs, Not(is_pic))) X86_64.enc(base.func_addr.i64, *r.allones_fnaddr8.rex(0xb8, w=1), isap=And(allones_funcaddrs, Not(is_pic))) # 64-bit, colocated, both PIC and non-PIC. Use the lea instruction's # pc-relative field. X86_64.enc(base.func_addr.i64,
has_ssse3 = BoolSetting("SSSE3: CPUID.01H:ECX.SSSE3[bit 9]") has_sse41 = BoolSetting("SSE4.1: CPUID.01H:ECX.SSE4_1[bit 19]") has_sse42 = BoolSetting("SSE4.2: CPUID.01H:ECX.SSE4_2[bit 20]") has_popcnt = BoolSetting("POPCNT: CPUID.01H:ECX.POPCNT[bit 23]") has_avx = BoolSetting("AVX: CPUID.01H:ECX.AVX[bit 28]") # CPUID.(EAX=07H, ECX=0H):EBX has_bmi1 = BoolSetting("BMI1: CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]") has_bmi2 = BoolSetting("BMI2: CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]") # CPUID.EAX=80000001H:ECX has_lzcnt = BoolSetting("LZCNT: CPUID.EAX=80000001H:ECX.LZCNT[bit 5]") # The use_* settings here are used to determine if a feature can be used. use_sse41 = And(has_sse41) use_sse42 = And(has_sse42, use_sse41) use_popcnt = And(has_popcnt, has_sse42) use_bmi1 = And(has_bmi1) use_lzcnt = And(has_lzcnt) is_pic = And(shared.is_pic) not_is_pic = Not(shared.is_pic) all_ones_funcaddrs_and_not_is_pic = And(shared.allones_funcaddrs, Not(shared.is_pic)) not_all_ones_funcaddrs_and_not_is_pic = And(Not(shared.allones_funcaddrs), Not(shared.is_pic)) # Presets corresponding to x86 CPUs. baseline = Preset()
""" RISC-V settings. """ from __future__ import absolute_import from cdsl.settings import SettingGroup, BoolSetting from cdsl.predicates import And import base.settings as shared from .defs import ISA ISA.settings = SettingGroup('riscv', parent=shared.group) supports_m = BoolSetting("CPU supports the 'M' extension (mul/div)") supports_a = BoolSetting("CPU supports the 'A' extension (atomics)") supports_f = BoolSetting("CPU supports the 'F' extension (float)") supports_d = BoolSetting("CPU supports the 'D' extension (double)") enable_m = BoolSetting( "Enable the use of 'M' instructions if available", default=True) use_m = And(supports_m, enable_m) use_a = And(supports_a, shared.enable_atomics) use_f = And(supports_f, shared.enable_float) use_d = And(supports_d, shared.enable_float) full_float = And(shared.enable_simd, supports_f, supports_d) ISA.settings.close(globals())
# CPUID.01H:ECX has_sse3 = BoolSetting("SSE3: CPUID.01H:ECX.SSE3[bit 0]") has_ssse3 = BoolSetting("SSSE3: CPUID.01H:ECX.SSSE3[bit 9]") has_sse41 = BoolSetting("SSE4.1: CPUID.01H:ECX.SSE4_1[bit 19]") has_sse42 = BoolSetting("SSE4.2: CPUID.01H:ECX.SSE4_2[bit 20]") has_popcnt = BoolSetting("POPCNT: CPUID.01H:ECX.POPCNT[bit 23]") has_avx = BoolSetting("AVX: CPUID.01H:ECX.AVX[bit 28]") # CPUID.(EAX=07H, ECX=0H):EBX has_bmi1 = BoolSetting("BMI1: CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]") has_bmi2 = BoolSetting("BMI2: CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]") # CPUID.EAX=80000001H:ECX has_lzcnt = BoolSetting("LZCNT: CPUID.EAX=80000001H:ECX.LZCNT[bit 5]") # The use_* settings here are used to determine if a feature can be used. use_sse41 = And(has_sse41) use_sse42 = And(has_sse42, use_sse41) use_popcnt = And(has_popcnt, has_sse42) use_bmi1 = And(has_bmi1) use_lzcnt = And(has_lzcnt) # Presets corresponding to Intel CPUs. baseline = Preset() nehalem = Preset(has_sse3, has_ssse3, has_sse41, has_sse42, has_popcnt) haswell = Preset(nehalem, has_bmi1, has_lzcnt) ISA.settings.close(globals())