[PATCH] D44390: [InstCombine] [NFC] Add tests for peeking through FP casts for sign-bit compares (PR36682)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 12 09:04:39 PDT 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/cast-int-icmp-eq-0.ll:89-100
+define i1 @i32_cast_cmp_sle_int_0_sitofp_float(i32 %i) {
+; CHECK-LABEL: @i32_cast_cmp_sle_int_0_sitofp_float(
+; CHECK-NEXT:    [[F:%.*]] = sitofp i32 [[I:%.*]] to float
+; CHECK-NEXT:    [[B:%.*]] = bitcast float [[F]] to i32
+; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[B]], 1
+; CHECK-NEXT:    ret i1 [[CMP]]
+;
----------------
As the current check line shows, this verifies that we canonicalize the predicate to 'slt'. Once that canonicalization is made, the test is identical to a later test (see below), so I don't think it's worth duplicating this or similar tests with sle/sge predicates. Remove all of those?

```
define i1 @i32_cast_cmp_slt_int_1_sitofp_float(i32 %i) {
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_float(
; CHECK-NEXT:    [[F:%.*]] = sitofp i32 [[I:%.*]] to float
; CHECK-NEXT:    [[B:%.*]] = bitcast float [[F]] to i32
; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[B]], 1
; CHECK-NEXT:    ret i1 [[CMP]]
;
  %f = sitofp i32 %i to float
  %b = bitcast float %f to i32
  %cmp = icmp slt i32 %b, 1
  ret i1 %cmp
}

```


Repository:
  rL LLVM

https://reviews.llvm.org/D44390





More information about the llvm-commits mailing list