jameysharp opened issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule (const (ty_int ty) n) (iconst ty n)) (rule (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
jameysharp labeled issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule (const (ty_int ty) n) (iconst ty n)) (rule (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
jameysharp labeled issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule (const (ty_int ty) n) (iconst ty n)) (rule (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
jameysharp labeled issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule (const (ty_int ty) n) (iconst ty n)) (rule (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
jameysharp labeled issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule (const (ty_int ty) n) (iconst ty n)) (rule (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
jameysharp edited issue #6038:
Feature
In our mid-end optimization rules we sometimes need to construct new constants, where the constant's type comes from somewhere in the left-hand side pattern. We should add a helper term that constructs constants without having to know whether we need to use
iconst
,vconst
,f32const
,f64const
, …Benefit
We can write more general optimizations without needing a lot of special cases.
Implementation
I'm pretty sure this isn't quite right, but I'm thinking of an ISLE term something along these lines:
(decl pure const (Type u64) Value) (rule 2 (const $I128 n) (uextend $I128 (iconst $I64 n)) (rule 1 (const (ty_int ty) n) (iconst ty n)) (rule 0 (const (ty_vec ty) n) (splat ty (const (lane_type ty) n)))
I don't know whether this should go in
prelude-opt.isle
orprelude.isle
. It depends on whether it's useful in lowering as well as optimization. I think it probably isn't useful in lowering and should go in the optimization-specific prelude.Thanks to @fitzgen for the general idea.
Last updated: Nov 22 2024 at 16:03 UTC