@@ -1000,7 +1000,7 @@ func.func @tripleAddAddOvf2(%arg0: index) -> index {
1000
1000
1001
1001
1002
1002
// CHECK-LABEL: @foldSubXX_tensor
1003
- // CHECK: %[[c0:.+]] = arith.constant dense<0> : tensor<10xi32>
1003
+ // CHECK: %[[c0:.+]] = arith.constant dense<0> : tensor<10xi32>
1004
1004
// CHECK: %[[sub:.+]] = arith.subi
1005
1005
// CHECK: return %[[c0]], %[[sub]]
1006
1006
func.func @foldSubXX_tensor (%static : tensor <10 xi32 >, %dyn : tensor <?x?xi32 >) -> (tensor <10 xi32 >, tensor <?x?xi32 >) {
@@ -2952,6 +2952,118 @@ func.func @truncIShrSIToTrunciShrUIBadShiftAmt2(%a: i64) -> i32 {
2952
2952
return %hi : i32
2953
2953
}
2954
2954
2955
+ // CHECK-LABEL: @wideMulToMulSIExtended
2956
+ // CHECK-SAME: (%[[A:.+]]: i32, %[[B:.+]]: i32)
2957
+ // CHECK-NEXT: %[[LOW:.+]], %[[HIGH:.+]] = arith.mulsi_extended %[[A]], %[[B]] : i32
2958
+ // CHECK-NEXT: return %[[HIGH]] : i32
2959
+ func.func @wideMulToMulSIExtended (%a: i32 , %b: i32 ) -> i32 {
2960
+ %x = arith.extsi %a: i32 to i64
2961
+ %y = arith.extsi %b: i32 to i64
2962
+ %m = arith.muli %x , %y: i64
2963
+ %c32 = arith.constant 32 : i64
2964
+ %sh = arith.shrui %m , %c32 : i64
2965
+ %hi = arith.trunci %sh: i64 to i32
2966
+ return %hi : i32
2967
+ }
2968
+
2969
+ // CHECK-LABEL: @wideMulToMulSIExtendedVector
2970
+ // CHECK-SAME: (%[[A:.+]]: vector<3xi32>, %[[B:.+]]: vector<3xi32>)
2971
+ // CHECK-NEXT: %[[LOW:.+]], %[[HIGH:.+]] = arith.mulsi_extended %[[A]], %[[B]] : vector<3xi32>
2972
+ // CHECK-NEXT: return %[[HIGH]] : vector<3xi32>
2973
+ func.func @wideMulToMulSIExtendedVector (%a: vector <3 xi32 >, %b: vector <3 xi32 >) -> vector <3 xi32 > {
2974
+ %x = arith.extsi %a: vector <3 xi32 > to vector <3 xi64 >
2975
+ %y = arith.extsi %b: vector <3 xi32 > to vector <3 xi64 >
2976
+ %m = arith.muli %x , %y: vector <3 xi64 >
2977
+ %c32 = arith.constant dense <32 >: vector <3 xi64 >
2978
+ %sh = arith.shrui %m , %c32 : vector <3 xi64 >
2979
+ %hi = arith.trunci %sh: vector <3 xi64 > to vector <3 xi32 >
2980
+ return %hi : vector <3 xi32 >
2981
+ }
2982
+
2983
+ // CHECK-LABEL: @wideMulToMulUIExtended
2984
+ // CHECK-SAME: (%[[A:.+]]: i32, %[[B:.+]]: i32)
2985
+ // CHECK-NEXT: %[[LOW:.+]], %[[HIGH:.+]] = arith.mului_extended %[[A]], %[[B]] : i32
2986
+ // CHECK-NEXT: return %[[HIGH]] : i32
2987
+ func.func @wideMulToMulUIExtended (%a: i32 , %b: i32 ) -> i32 {
2988
+ %x = arith.extui %a: i32 to i64
2989
+ %y = arith.extui %b: i32 to i64
2990
+ %m = arith.muli %x , %y: i64
2991
+ %c32 = arith.constant 32 : i64
2992
+ %sh = arith.shrui %m , %c32 : i64
2993
+ %hi = arith.trunci %sh: i64 to i32
2994
+ return %hi : i32
2995
+ }
2996
+
2997
+ // CHECK-LABEL: @wideMulToMulUIExtendedVector
2998
+ // CHECK-SAME: (%[[A:.+]]: vector<3xi32>, %[[B:.+]]: vector<3xi32>)
2999
+ // CHECK-NEXT: %[[LOW:.+]], %[[HIGH:.+]] = arith.mului_extended %[[A]], %[[B]] : vector<3xi32>
3000
+ // CHECK-NEXT: return %[[HIGH]] : vector<3xi32>
3001
+ func.func @wideMulToMulUIExtendedVector (%a: vector <3 xi32 >, %b: vector <3 xi32 >) -> vector <3 xi32 > {
3002
+ %x = arith.extui %a: vector <3 xi32 > to vector <3 xi64 >
3003
+ %y = arith.extui %b: vector <3 xi32 > to vector <3 xi64 >
3004
+ %m = arith.muli %x , %y: vector <3 xi64 >
3005
+ %c32 = arith.constant dense <32 >: vector <3 xi64 >
3006
+ %sh = arith.shrui %m , %c32 : vector <3 xi64 >
3007
+ %hi = arith.trunci %sh: vector <3 xi64 > to vector <3 xi32 >
3008
+ return %hi : vector <3 xi32 >
3009
+ }
3010
+
3011
+ // CHECK-LABEL: @wideMulToMulIExtendedMixedExt
3012
+ // CHECK: arith.muli
3013
+ // CHECK: arith.shrui
3014
+ // CHECK: arith.trunci
3015
+ func.func @wideMulToMulIExtendedMixedExt (%a: i32 , %b: i32 ) -> i32 {
3016
+ %x = arith.extsi %a: i32 to i64
3017
+ %y = arith.extui %b: i32 to i64
3018
+ %m = arith.muli %x , %y: i64
3019
+ %c32 = arith.constant 32 : i64
3020
+ %sh = arith.shrui %m , %c32 : i64
3021
+ %hi = arith.trunci %sh: i64 to i32
3022
+ return %hi : i32
3023
+ }
3024
+
3025
+ // CHECK-LABEL: @wideMulToMulSIExtendedBadExt
3026
+ // CHECK: arith.muli
3027
+ // CHECK: arith.shrui
3028
+ // CHECK: arith.trunci
3029
+ func.func @wideMulToMulSIExtendedBadExt (%a: i16 , %b: i16 ) -> i32 {
3030
+ %x = arith.extsi %a: i16 to i64
3031
+ %y = arith.extsi %b: i16 to i64
3032
+ %m = arith.muli %x , %y: i64
3033
+ %c32 = arith.constant 32 : i64
3034
+ %sh = arith.shrui %m , %c32 : i64
3035
+ %hi = arith.trunci %sh: i64 to i32
3036
+ return %hi : i32
3037
+ }
3038
+
3039
+ // CHECK-LABEL: @wideMulToMulSIExtendedBadShift1
3040
+ // CHECK: arith.muli
3041
+ // CHECK: arith.shrui
3042
+ // CHECK: arith.trunci
3043
+ func.func @wideMulToMulSIExtendedBadShift1 (%a: i32 , %b: i32 ) -> i32 {
3044
+ %x = arith.extsi %a: i32 to i64
3045
+ %y = arith.extsi %b: i32 to i64
3046
+ %m = arith.muli %x , %y: i64
3047
+ %c33 = arith.constant 33 : i64
3048
+ %sh = arith.shrui %m , %c33 : i64
3049
+ %hi = arith.trunci %sh: i64 to i32
3050
+ return %hi : i32
3051
+ }
3052
+
3053
+ // CHECK-LABEL: @wideMulToMulSIExtendedBadShift2
3054
+ // CHECK: arith.muli
3055
+ // CHECK: arith.shrui
3056
+ // CHECK: arith.trunci
3057
+ func.func @wideMulToMulSIExtendedBadShift2 (%a: i32 , %b: i32 ) -> i32 {
3058
+ %x = arith.extsi %a: i32 to i64
3059
+ %y = arith.extsi %b: i32 to i64
3060
+ %m = arith.muli %x , %y: i64
3061
+ %c31 = arith.constant 31 : i64
3062
+ %sh = arith.shrui %m , %c31 : i64
3063
+ %hi = arith.trunci %sh: i64 to i32
3064
+ return %hi : i32
3065
+ }
3066
+
2955
3067
// CHECK-LABEL: @foldShli0
2956
3068
// CHECK-SAME: (%[[ARG:.*]]: i64)
2957
3069
// CHECK: return %[[ARG]] : i64
0 commit comments