MCPcopy Create free account
hub / github.com/chc4/lineiform / bor

Function bor

tangle/src/oper.rs:378–416  ·  view source on GitHub ↗
(&mut self, mut left: JitTemp, mut right: JitTemp)

Source from the content-addressed store, hash-verified

376 }
377
378 pub fn bor(&mut self, mut left: JitTemp, mut right: JitTemp) -> JitTemp {
379 use JitTemp::*;
380 let biggest = max(left.width(), right.width());
381 left = left.zero_extend(self.builder, biggest);
382 right = right.zero_extend(self.builder, biggest);
383 // XXX: set flags!!
384 match (left.clone(), right.clone()) {
385 (c, other) | (other, c) if c.is_const() => {
386 let fixed_c = c.into_usize(self.builder).unwrap();
387 match (fixed_c, other) {
388 //0 | val or val | 0 = 0
389 (0, val) => return val,
390 // left_c | right_c is just left | right
391 (fixed_c, other) if other.is_const() => {
392 let fixed_other = other.into_usize(self.builder).unwrap();
393 return JitTemp::val_of_width(fixed_c | fixed_other, biggest)
394 },
395 (_, _) => (),
396 }
397 },
398 _ => (),
399 };
400
401 match (left, right) {
402 (Value(val_left, typ_left), Value(val_right, typ_right)) => {
403 Value(self.builder.ins().bor(val_left, val_right), typ_left)
404 },
405 (val @ _, Value(ssa, ssa_typ))
406 | (Value(ssa, ssa_typ), val @ _) => {
407 let ssa_val = val.into_ssa(self.int, self.builder);
408 Value(self.builder.ins().bor(ssa_val, ssa), ssa_typ)
409 },
410 (Ref(base, offset), _)
411 | (_, Ref(base, offset)) => {
412 unimplemented!("bor pointer")
413 },
414 (left, right) => unimplemented!("unimplemented bor {:?} {:?}", left, right)
415 }
416 }
417
418 pub fn bxor(&mut self, mut left: JitTemp, mut right: JitTemp) -> JitTemp {
419 use JitTemp::*;

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.80

Tested by

no test coverage detected