Index: include/llvm/Target/Target.td =================================================================== --- include/llvm/Target/Target.td +++ include/llvm/Target/Target.td @@ -1553,3 +1553,8 @@ // Pull in the common support for the Global ISel DAG-based selector generation. // include "llvm/Target/GlobalISel/SelectionDAGCompat.td" + +//===----------------------------------------------------------------------===// +// Pull in the common support for exegesis. +// +include "llvm/Target/TargetExegesis.td" Index: include/llvm/Target/TargetExegesis.td =================================================================== --- /dev/null +++ include/llvm/Target/TargetExegesis.td @@ -0,0 +1,59 @@ +//===- TargetExegesis.td - Target Exegesis Configuration ---*- tablegen -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// A `bit precise` value to use as operand for an Instruction in to use with llvm-exegesis. +class OperandValue; + +// A configuration for llvm-exegesis to test `Instruction` +class ExegesisConfiguration { + Instruction Instruction = ?; // The instruction to test. + list OperandValues; // The initial values before repeating the instruction. +} + +// A single value (integer or floating point) +class ScalarValue : OperandValue; + +// A scalar value broadcasted in a packed type. +class PackedValue : OperandValue { + ScalarValue BroadcastValue; +} + +// Floating Point description + +// The precision of the floating point. +class Ieee754Precision; +def HalfPrecision : Ieee754Precision; +def SinglePrecision : Ieee754Precision; +def DoublePrecision : Ieee754Precision; +def X87Precision : Ieee754Precision; + +// The value to set the exponent to (exact value depends on the precision). +class RawExponentValue; +def RawExponentZero : RawExponentValue; +def RawExponentMax : RawExponentValue; +def RawExponentBias : RawExponentValue; + +// The value to set the mantissa to (exact value depends on the precision). +class MantissaValue; +def MantissaZero : MantissaValue; +def MantissaOne : MantissaValue; +def MantissaMax : MantissaValue; + +// An instance of the floating point value. +class Ieee754 : ScalarValue { + Ieee754Precision Precision; + bit Sign; + RawExponentValue Exponent; + MantissaValue Mantissa; +} + +// Integer Description. +class Integer : ScalarValue { + list Bits; +} Index: lib/Target/X86/X86.td =================================================================== --- lib/Target/X86/X86.td +++ lib/Target/X86/X86.td @@ -1200,3 +1200,9 @@ //===----------------------------------------------------------------------===// include "X86PfmCounters.td" + +//===----------------------------------------------------------------------===// +// Exegesis Configurations +//===----------------------------------------------------------------------===// + +include "X86ExegesisConfigurations.td" Index: lib/Target/X86/X86ExegesisConfigurations.td =================================================================== --- /dev/null +++ lib/Target/X86/X86ExegesisConfigurations.td @@ -0,0 +1,27 @@ +def One : Ieee754 { + let Precision = SinglePrecision; + let Sign = 0; + let Exponent = RawExponentBias; + let Mantissa = MantissaZero; +} + +def OnePlusEpsilon : Ieee754 { + let Precision = SinglePrecision; + let Sign = 0; + let Exponent = RawExponentBias; + let Mantissa = MantissaOne; +} + +def PackedOnes : PackedValue { + let BroadcastValue = One; +} + +def PackedOnePlusEpsilons : PackedValue { + let BroadcastValue = OnePlusEpsilon; +} + +let Instruction = VDIVPDrr in { + def VDIVPDrrExegesisConfiguration : ExegesisConfiguration { + let OperandValues = [PackedOnes, PackedOnePlusEpsilons]; + } +}