Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s

define i32 @test1(i32 %X) {
; CHECK-LABEL: test1:
; CHECK:       @ %bb.0: @ %entry
; CHECK-NEXT:    lsrs r0, r0, #31
; CHECK-NEXT:    bx lr
entry:
  icmp slt i32 %X, 0              ; <i1>:0 [#uses=1]
  zext i1 %0 to i32               ; <i32>:1 [#uses=1]
  ret i32 %1
}

define i32 @test2(i32 %X) {
; CHECK-LABEL: test2:
; CHECK:       @ %bb.0: @ %entry
; CHECK-NEXT:    movs r1, #1
; CHECK-NEXT:    lsls r1, r1, #31
; CHECK-NEXT:    adds r0, r0, r1
; CHECK-NEXT:    bx lr
entry:
  %tmp1 = sub i32 %X, 2147483648
  ret i32 %tmp1
}