MCPcopy Create free account
hub / github.com/google/gapid / ShiftRight

Method ShiftRight

core/codegen/arithmetic.go:294–305  ·  view source on GitHub ↗

ShiftRight performs a bit-shift right by shift bits.

(x, y *Value)

Source from the content-addressed store, hash-verified

292
293// ShiftRight performs a bit-shift right by shift bits.
294func (b *Builder) ShiftRight(x, y *Value) *Value {
295 assertTypesEqual(x.Type(), y.Type())
296 ty := x.Type()
297 switch {
298 case IsSignedInteger(ty):
299 return b.val(ty, b.llvm.CreateAShr(x.llvm, y.llvm, x.Name()+">>"+y.Name()))
300 case IsUnsignedInteger(ty):
301 return b.val(ty, b.llvm.CreateLShr(x.llvm, y.llvm, x.Name()+">>"+y.Name()))
302 default:
303 panic(fmt.Errorf("Cannot divide values of type %v", ty))
304 }
305}
306
307// Select returns (cond ? x : y). x and y must be of the same type.
308func (b *Builder) Select(cond, x, y *Value) *Value {

Callers 4

hash64BitMethod · 0.80
hashValueMethod · 0.80
doBinaryOpMethod · 0.80
buildWriteFuncsMethod · 0.80

Calls 6

valMethod · 0.95
assertTypesEqualFunction · 0.85
IsSignedIntegerFunction · 0.85
IsUnsignedIntegerFunction · 0.85
TypeMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected