Index: llvm/trunk/lib/Target/AMDGPU/MIMGInstructions.td =================================================================== --- llvm/trunk/lib/Target/AMDGPU/MIMGInstructions.td +++ llvm/trunk/lib/Target/AMDGPU/MIMGInstructions.td @@ -80,9 +80,9 @@ let Key = ["AsmSuffix"]; } -class mimg si_gfx10, bits<7> vi = si_gfx10> { - field bits<7> SI_GFX10 = si_gfx10; - field bits<7> VI = vi; +class mimg si_gfx10, bits<8> vi = si_gfx10> { + field bits<8> SI_GFX10 = si_gfx10; + field bits<8> VI = vi; } class MIMGLZMapping { @@ -117,7 +117,7 @@ let PrimaryKeyName = "getMIMGMIPMappingInfo"; } -class MIMG +class MIMG_Base : InstSI { let VM_CNT = 1; @@ -126,15 +126,20 @@ let Uses = [EXEC]; let mayLoad = 1; let mayStore = 0; - let hasPostISelHook = 1; let SchedRW = [WriteVMEM]; let UseNamedOperandTable = 1; let hasSideEffects = 0; // XXX ???? let DecoderNamespace = dns; let isAsmParserOnly = !if(!eq(dns,""), 1, 0); - let AsmMatchConverter = "cvtMIMG"; let usesCustomInserter = 1; +} + +class MIMG + : MIMG_Base { + + let hasPostISelHook = 1; + let AsmMatchConverter = "cvtMIMG"; Instruction Opcode = !cast(NAME); MIMGBaseOpcode BaseOpcode; @@ -175,7 +180,7 @@ } // Base class of all pre-gfx10 MIMG instructions. -class MIMG_gfx6789 op, dag outs, string dns = ""> +class MIMG_gfx6789 op, dag outs, string dns = ""> : MIMG, MIMGe_gfx6789 { let SubtargetPredicate = isGFX6GFX7GFX8GFX9; let AssemblerPredicates = [isGFX6GFX7GFX8GFX9]; @@ -214,7 +219,7 @@ let nsa = nsah.NSA; } -class MIMG_NoSampler_Helper op, string asm, +class MIMG_NoSampler_Helper op, string asm, RegisterClass dst_rc, RegisterClass addr_rc, string dns=""> @@ -252,7 +257,7 @@ #!if(BaseOpcode.HasD16, "$d16", ""); } -multiclass MIMG_NoSampler_Src_Helper op, string asm, +multiclass MIMG_NoSampler_Src_Helper op, string asm, RegisterClass dst_rc, bit enableDisasm> { let ssamp = 0 in { @@ -284,9 +289,9 @@ } } -multiclass MIMG_NoSampler op, string asm, bit has_d16, bit mip = 0, +multiclass MIMG_NoSampler op, string asm, bit has_d16, bit mip = 0, bit isResInfo = 0> { - def "" : MIMGBaseOpcode { + def "" : MIMGBaseOpcode, PredicateControl { let Coordinates = !if(isResInfo, 0, 1); let LodOrClampOrMip = mip; let HasD16 = has_d16; @@ -307,7 +312,7 @@ } } -class MIMG_Store_Helper op, string asm, +class MIMG_Store_Helper op, string asm, RegisterClass data_rc, RegisterClass addr_rc, string dns = ""> @@ -376,7 +381,7 @@ } } -multiclass MIMG_Store op, string asm, bit has_d16, bit mip = 0> { +multiclass MIMG_Store op, string asm, bit has_d16, bit mip = 0> { def "" : MIMGBaseOpcode { let Store = 1; let LodOrClampOrMip = mip; @@ -395,7 +400,7 @@ } } -class MIMG_Atomic_gfx6789_base op, string asm, RegisterClass data_rc, +class MIMG_Atomic_gfx6789_base op, string asm, RegisterClass data_rc, RegisterClass addr_rc, string dns=""> : MIMG_gfx6789 { let Constraints = "$vdst = $vdata"; @@ -500,7 +505,7 @@ } } -class MIMG_Sampler_Helper op, string asm, RegisterClass dst_rc, +class MIMG_Sampler_Helper op, string asm, RegisterClass dst_rc, RegisterClass src_rc, string dns=""> : MIMG_gfx6789 { let InOperandList = !con((ins src_rc:$vaddr, SReg_256:$srsrc, SReg_128:$ssamp, @@ -609,7 +614,7 @@ lhs)))); } -multiclass MIMG_Sampler_Src_Helper op, string asm, +multiclass MIMG_Sampler_Src_Helper op, string asm, AMDGPUSampleVariant sample, RegisterClass dst_rc, bit enableDisasm = 0> { foreach addr = MIMG_Sampler_AddrSizes.MachineInstrs in { @@ -640,7 +645,7 @@ let LodOrClampOrMip = !ne(sample.LodOrClamp, ""); } -multiclass MIMG_Sampler op, AMDGPUSampleVariant sample, bit wqm = 0, +multiclass MIMG_Sampler op, AMDGPUSampleVariant sample, bit wqm = 0, bit isGetLod = 0, string asm = "image_sample"#sample.LowerCaseMod> { def "" : MIMG_Sampler_BaseOpcode { @@ -662,10 +667,10 @@ } } -multiclass MIMG_Sampler_WQM op, AMDGPUSampleVariant sample> +multiclass MIMG_Sampler_WQM op, AMDGPUSampleVariant sample> : MIMG_Sampler; -multiclass MIMG_Gather op, AMDGPUSampleVariant sample, bit wqm = 0, +multiclass MIMG_Gather op, AMDGPUSampleVariant sample, bit wqm = 0, string asm = "image_gather4"#sample.LowerCaseMod> { def "" : MIMG_Sampler_BaseOpcode { let HasD16 = 1; @@ -683,7 +688,7 @@ } } -multiclass MIMG_Gather_WQM op, AMDGPUSampleVariant sample> +multiclass MIMG_Gather_WQM op, AMDGPUSampleVariant sample> : MIMG_Gather; //===----------------------------------------------------------------------===// Index: llvm/trunk/lib/Target/AMDGPU/SIInstrFormats.td =================================================================== --- llvm/trunk/lib/Target/AMDGPU/SIInstrFormats.td +++ llvm/trunk/lib/Target/AMDGPU/SIInstrFormats.td @@ -283,12 +283,13 @@ let Inst{63} = d16; } -class MIMGe_gfx6789 op> : MIMGe { +class MIMGe_gfx6789 op> : MIMGe { bits<8> vaddr; bits<1> da; + let Inst{0} = op{7}; let Inst{14} = da; - let Inst{24-18} = op; + let Inst{24-18} = op{6-0}; let Inst{39-32} = vaddr; }