# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
-# RUN: llc -mtriple=amdgcn-amd-amdhsa -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
+# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
---
name: remove_and_255_zextload
$vgpr0 = COPY %and
...
+
+# Test known bits for groupstaticsize is the maximum LDS size.
+---
+name: remove_and_65535_groupstaticsize
+legalized: true
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+ ; CHECK-LABEL: name: remove_and_65535_groupstaticsize
+ ; CHECK: liveins: $vgpr0_vgpr1
+ ; CHECK: %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ ; CHECK: %mask:_(s32) = G_CONSTANT i32 65535
+ ; CHECK: %and:_(s32) = G_AND %lds_size, %mask
+ ; CHECK: $vgpr0 = COPY %and(s32)
+ %ptr:_(p1) = COPY $vgpr0_vgpr1
+ %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ %mask:_(s32) = G_CONSTANT i32 65535
+ %and:_(s32) = G_AND %lds_size, %mask
+ $vgpr0 = COPY %and
+
+...
+
+---
+name: remove_and_131071_groupstaticsize
+legalized: true
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+ ; CHECK-LABEL: name: remove_and_131071_groupstaticsize
+ ; CHECK: liveins: $vgpr0_vgpr1
+ ; CHECK: %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ ; CHECK: $vgpr0 = COPY %lds_size(s32)
+ %ptr:_(p1) = COPY $vgpr0_vgpr1
+ %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ %mask:_(s32) = G_CONSTANT i32 131071
+ %and:_(s32) = G_AND %lds_size, %mask
+ $vgpr0 = COPY %and
+
+...
+
+---
+name: no_remove_and_65536_groupstaticsize
+legalized: true
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+ ; CHECK-LABEL: name: no_remove_and_65536_groupstaticsize
+ ; CHECK: liveins: $vgpr0_vgpr1
+ ; CHECK: %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ ; CHECK: %mask:_(s32) = G_CONSTANT i32 65536
+ ; CHECK: %and:_(s32) = G_AND %lds_size, %mask
+ ; CHECK: $vgpr0 = COPY %and(s32)
+ %ptr:_(p1) = COPY $vgpr0_vgpr1
+ %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ %mask:_(s32) = G_CONSTANT i32 65536
+ %and:_(s32) = G_AND %lds_size, %mask
+ $vgpr0 = COPY %and
+
+...
+
+---
+name: no_remove_and_32767_groupstaticsize
+legalized: true
+tracksRegLiveness: true
+body: |
+ bb.0:
+ liveins: $vgpr0_vgpr1
+ ; CHECK-LABEL: name: no_remove_and_32767_groupstaticsize
+ ; CHECK: liveins: $vgpr0_vgpr1
+ ; CHECK: %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ ; CHECK: %mask:_(s32) = G_CONSTANT i32 32767
+ ; CHECK: %and:_(s32) = G_AND %lds_size, %mask
+ ; CHECK: $vgpr0 = COPY %and(s32)
+ %ptr:_(p1) = COPY $vgpr0_vgpr1
+ %lds_size:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.groupstaticsize)
+ %mask:_(s32) = G_CONSTANT i32 32767
+ %and:_(s32) = G_AND %lds_size, %mask
+ $vgpr0 = COPY %and
+
+...