@@ -2857,6 +2857,37 @@ func.func @contiguous_gather(%base: memref<?xf32>,
28572857
28582858// -----
28592859
2860+ // CHECK-LABEL: @contiguous_gather_non_zero_start(
2861+ // TODO: Non-zero start is not supported yet.
2862+ // CHECK: %[[R:.*]] = vector.gather
2863+ // CHECK: return %[[R]]
2864+ func.func @contiguous_gather_non_zero_start (%base: memref <?xf32 >,
2865+ %mask: vector <16 xi1 >,
2866+ %passthru: vector <16 xf32 >) -> vector <16 xf32 > {
2867+ %c0 = arith.constant 0 : index
2868+ %indices = arith.constant dense <[1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 ]> : vector <16 xi32 >
2869+ %1 = vector.gather %base [%c0 ][%indices ], %mask , %passthru :
2870+ memref <?xf32 >, vector <16 xi32 >, vector <16 xi1 >, vector <16 xf32 > into vector <16 xf32 >
2871+ return %1 : vector <16 xf32 >
2872+ }
2873+
2874+ // -----
2875+
2876+ // CHECK-LABEL: @contiguous_gather_2d(
2877+ // TODO: Only 1D vectors are supported.
2878+ // CHECK: %[[R:.*]] = vector.gather
2879+ // CHECK: return %[[R]]
2880+ func.func @contiguous_gather_2d (%base: memref <?x?xf32 >,
2881+ %mask: vector <4 x4 xi1 >, %passthru: vector <4 x4 xf32 >) -> vector <4 x4 xf32 > {
2882+ %c0 = arith.constant 0 : index
2883+ %indices = arith.constant dense <[[0 , 1 , 2 , 3 ], [4 , 5 , 6 , 7 ], [8 , 9 , 10 , 11 ], [12 , 13 , 14 , 15 ]]> : vector <4 x4 xi32 >
2884+ %1 = vector.gather %base [%c0 , %c0 ][%indices ], %mask , %passthru :
2885+ memref <?x?xf32 >, vector <4 x4 xi32 >, vector <4 x4 xi1 >, vector <4 x4 xf32 > into vector <4 x4 xf32 >
2886+ return %1 : vector <4 x4 xf32 >
2887+ }
2888+
2889+ // -----
2890+
28602891// CHECK-LABEL: @contiguous_gather_const_mask
28612892// CHECK-SAME: (%[[BASE:.*]]: memref<?xf32>, %[[PASSTHRU:.*]]: vector<16xf32>)
28622893// CHECK: %[[C0:.*]] = arith.constant 0 : index
@@ -2890,6 +2921,21 @@ func.func @contiguous_gather_step(%base: memref<?xf32>,
28902921
28912922// -----
28922923
2924+ // CHECK-LABEL: @gather_broadcast(
2925+ // TODO: Broadcast is not supported yet
2926+ // CHECK: %[[R:.*]] = vector.gather
2927+ // CHECK: return %[[R]]
2928+ func.func @gather_broadcast (%base: memref <?xf32 >,
2929+ %mask: vector <16 xi1 >, %passthru: vector <16 xf32 >) -> vector <16 xf32 > {
2930+ %c0 = arith.constant 0 : index
2931+ %indices = arith.constant dense <0 > : vector <16 xi32 >
2932+ %1 = vector.gather %base [%c0 ][%indices ], %mask , %passthru :
2933+ memref <?xf32 >, vector <16 xi32 >, vector <16 xi1 >, vector <16 xf32 > into vector <16 xf32 >
2934+ return %1 : vector <16 xf32 >
2935+ }
2936+
2937+ // -----
2938+
28932939// CHECK-LABEL: @contiguous_scatter
28942940// CHECK-SAME: (%[[BASE:.*]]: memref<?xf32>, %[[MASK:.*]]: vector<16xi1>, %[[VALUE:.*]]: vector<16xf32>)
28952941// CHECK: %[[C0:.*]] = arith.constant 0 : index
0 commit comments