Cranelift: Collapse double extends into a single extend (#5772)
This commit is contained in:
@@ -6,6 +6,12 @@
|
|||||||
;; than a piece of the input or a new node that we construct; but we
|
;; than a piece of the input or a new node that we construct; but we
|
||||||
;; can freely rewrite e.g. `x+y-y` to `x`.
|
;; can freely rewrite e.g. `x+y-y` to `x`.
|
||||||
|
|
||||||
|
;; Chained `uextend` and `sextend`.
|
||||||
|
(rule (simplify (uextend ty (uextend _intermediate_ty x)))
|
||||||
|
(uextend ty x))
|
||||||
|
(rule (simplify (sextend ty (sextend _intermediate_ty x)))
|
||||||
|
(sextend ty x))
|
||||||
|
|
||||||
;; x+0 == 0+x == x.
|
;; x+0 == 0+x == x.
|
||||||
(rule (simplify (iadd ty
|
(rule (simplify (iadd ty
|
||||||
x
|
x
|
||||||
|
|||||||
@@ -337,3 +337,23 @@ block0(v1: i32):
|
|||||||
|
|
||||||
; check: v5 = iconst.i8 1
|
; check: v5 = iconst.i8 1
|
||||||
; check: return v5
|
; check: return v5
|
||||||
|
|
||||||
|
function %double_uextend(i16) -> i64 {
|
||||||
|
block0(v1: i16):
|
||||||
|
v2 = uextend.i32 v1
|
||||||
|
v3 = uextend.i64 v2
|
||||||
|
return v3
|
||||||
|
}
|
||||||
|
|
||||||
|
; check: v4 = uextend.i64 v1
|
||||||
|
; check: return v4
|
||||||
|
|
||||||
|
function %double_sextend(i16) -> i64 {
|
||||||
|
block0(v1: i16):
|
||||||
|
v2 = sextend.i32 v1
|
||||||
|
v3 = sextend.i64 v2
|
||||||
|
return v3
|
||||||
|
}
|
||||||
|
|
||||||
|
; check: v4 = sextend.i64 v1
|
||||||
|
; check: return v4
|
||||||
|
|||||||
Reference in New Issue
Block a user