Resolve this operand constraint into a concrete value type, given the value of the controlling type variable.
(&self, ctrl_type: Type)
| 899 | /// Resolve this operand constraint into a concrete value type, given the value of the |
| 900 | /// controlling type variable. |
| 901 | pub fn resolve(&self, ctrl_type: Type) -> ResolvedConstraint { |
| 902 | use self::OperandConstraint::*; |
| 903 | use self::ResolvedConstraint::Bound; |
| 904 | match *self { |
| 905 | Concrete(t) => Bound(t), |
| 906 | Free(vts) => ResolvedConstraint::Free(TYPE_SETS[vts as usize]), |
| 907 | Same => Bound(ctrl_type), |
| 908 | LaneOf => Bound(ctrl_type.lane_of()), |
| 909 | AsTruthy => Bound(ctrl_type.as_truthy()), |
| 910 | HalfWidth => Bound(ctrl_type.half_width().expect("invalid type for half_width")), |
| 911 | DoubleWidth => Bound( |
| 912 | ctrl_type |
| 913 | .double_width() |
| 914 | .expect("invalid type for double_width"), |
| 915 | ), |
| 916 | SplitLanes => { |
| 917 | if ctrl_type.is_dynamic_vector() { |
| 918 | Bound( |
| 919 | ctrl_type |
| 920 | .dynamic_to_vector() |
| 921 | .expect("invalid type for dynamic_to_vector") |
| 922 | .split_lanes() |
| 923 | .expect("invalid type for split_lanes") |
| 924 | .vector_to_dynamic() |
| 925 | .expect("invalid dynamic type"), |
| 926 | ) |
| 927 | } else { |
| 928 | Bound( |
| 929 | ctrl_type |
| 930 | .split_lanes() |
| 931 | .expect("invalid type for split_lanes"), |
| 932 | ) |
| 933 | } |
| 934 | } |
| 935 | MergeLanes => { |
| 936 | if ctrl_type.is_dynamic_vector() { |
| 937 | Bound( |
| 938 | ctrl_type |
| 939 | .dynamic_to_vector() |
| 940 | .expect("invalid type for dynamic_to_vector") |
| 941 | .merge_lanes() |
| 942 | .expect("invalid type for merge_lanes") |
| 943 | .vector_to_dynamic() |
| 944 | .expect("invalid dynamic type"), |
| 945 | ) |
| 946 | } else { |
| 947 | Bound( |
| 948 | ctrl_type |
| 949 | .merge_lanes() |
| 950 | .expect("invalid type for merge_lanes"), |
| 951 | ) |
| 952 | } |
| 953 | } |
| 954 | DynamicToVector => Bound( |
| 955 | ctrl_type |
| 956 | .dynamic_to_vector() |
| 957 | .expect("invalid type for dynamic_to_vector"), |
| 958 | ), |
no test coverage detected