implement vm{32,64}{x,y} operand checks
This commit is contained in:
@@ -172,26 +172,47 @@ func IsM256(op avo.Operand) bool {
|
||||
return IsM64(op)
|
||||
}
|
||||
|
||||
// IsVm32x returns true if op is a vector memory operand with 32-bit XMM index.
|
||||
func IsVm32x(op avo.Operand) bool {
|
||||
return false
|
||||
return IsVmx(op)
|
||||
}
|
||||
|
||||
// IsVm64x returns true if op is a vector memory operand with 64-bit XMM index.
|
||||
func IsVm64x(op avo.Operand) bool {
|
||||
return false
|
||||
return IsVmx(op)
|
||||
}
|
||||
|
||||
// IsVmx returns true if op is a vector memory operand with XMM index.
|
||||
func IsVmx(op avo.Operand) bool {
|
||||
return isvm(op, IsXmm)
|
||||
}
|
||||
|
||||
// IsVm32y returns true if op is a vector memory operand with 32-bit YMM index.
|
||||
func IsVm32y(op avo.Operand) bool {
|
||||
return false
|
||||
return IsVmy(op)
|
||||
}
|
||||
|
||||
// IsVm64y returns true if op is a vector memory operand with 64-bit YMM index.
|
||||
func IsVm64y(op avo.Operand) bool {
|
||||
return false
|
||||
return IsVmy(op)
|
||||
}
|
||||
|
||||
// IsVmy returns true if op is a vector memory operand with YMM index.
|
||||
func IsVmy(op avo.Operand) bool {
|
||||
return isvm(op, IsYmm)
|
||||
}
|
||||
|
||||
func isvm(op avo.Operand, idx func(avo.Operand) bool) bool {
|
||||
m, ok := op.(Mem)
|
||||
return ok && IsR64(m.Base) && idx(m.Index)
|
||||
}
|
||||
|
||||
func IsRel8(op avo.Operand) bool {
|
||||
// TODO(mbm): implement rel8 operand check
|
||||
return false
|
||||
}
|
||||
|
||||
func IsRel32(op avo.Operand) bool {
|
||||
// TODO(mbm): implement rel32 operand check
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -112,6 +112,23 @@ func TestChecks(t *testing.T) {
|
||||
|
||||
{IsM256, Mem{Base: reg.RBX, Index: reg.R12, Scale: 2}, true},
|
||||
{IsM256, Mem{Base: reg.R13L}, false},
|
||||
|
||||
// Vector memory operands
|
||||
{IsVm32x, Mem{Base: reg.R14, Index: reg.X11}, true},
|
||||
{IsVm32x, Mem{Base: reg.R14L, Index: reg.X11}, false},
|
||||
{IsVm32x, Mem{Base: reg.R14, Index: reg.Y11}, false},
|
||||
|
||||
{IsVm64x, Mem{Base: reg.R14, Index: reg.X11}, true},
|
||||
{IsVm64x, Mem{Base: reg.R14L, Index: reg.X11}, false},
|
||||
{IsVm64x, Mem{Base: reg.R14, Index: reg.Y11}, false},
|
||||
|
||||
{IsVm32y, Mem{Base: reg.R9, Index: reg.Y11}, true},
|
||||
{IsVm32y, Mem{Base: reg.R11L, Index: reg.Y11}, false},
|
||||
{IsVm32y, Mem{Base: reg.R8, Index: reg.Z11}, false},
|
||||
|
||||
{IsVm64y, Mem{Base: reg.R9, Index: reg.Y11}, true},
|
||||
{IsVm64y, Mem{Base: reg.R11L, Index: reg.Y11}, false},
|
||||
{IsVm64y, Mem{Base: reg.R8, Index: reg.Z11}, false},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
|
||||
Reference in New Issue
Block a user