32 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 52; RUN: llc -mtriple=nvptx64 -verify-machineinstrs < %s | FileCheck %s3; RUN: %if ptxas %{ llc -mtriple=nvptx64 -verify-machineinstrs < %s | %ptxas-verify %}4 5; Tests the following pattern:6; (X & 8) != 0 --> (X & 8) >> 37 8; This produces incorrect code in general when boolean false is9; represented as a negative one. There is however a special10; case when the type has a bitsize of 1, for which the false11; value will be identical regardless of the boolean representation.12; Check that the optimization triggers in this case.13 14define i32 @pow2_mask_cmp(i32 %x) {15; CHECK-LABEL: pow2_mask_cmp(16; CHECK: {17; CHECK-NEXT: .reg .b16 %rs<3>;18; CHECK-NEXT: .reg .b32 %r<3>;19; CHECK-EMPTY:20; CHECK-NEXT: // %bb.0:21; CHECK-NEXT: ld.param.b8 %rs1, [pow2_mask_cmp_param_0];22; CHECK-NEXT: shr.u16 %rs2, %rs1, 3;23; CHECK-NEXT: cvt.u32.u16 %r1, %rs2;24; CHECK-NEXT: and.b32 %r2, %r1, 1;25; CHECK-NEXT: st.param.b32 [func_retval0], %r2;26; CHECK-NEXT: ret;27 %a = and i32 %x, 828 %cmp = icmp ne i32 %a, 029 %r = zext i1 %cmp to i3230 ret i32 %r31}32