1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \ 3; RUN: | FileCheck -check-prefixes=RV32 %s 4; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \ 5; RUN: | FileCheck -check-prefixes=RV64 %s 6 7define signext i16 @func(ptr %a, ptr %b) { 8; RV32-LABEL: func: 9; RV32: # %bb.0: # %entry 10; RV32-NEXT: lh a0, 0(a0) 11; RV32-NEXT: bltz a0, .LBB0_3 12; RV32-NEXT: # %bb.1: # %.LBB0_1 13; RV32-NEXT: beqz a1, .LBB0_3 14; RV32-NEXT: # %bb.2: # %.LBB0_2 15; RV32-NEXT: ret 16; RV32-NEXT: .LBB0_3: # %return 17; RV32-NEXT: li a0, 0 18; RV32-NEXT: ret 19; 20; RV64-LABEL: func: 21; RV64: # %bb.0: # %entry 22; RV64-NEXT: lh a0, 0(a0) 23; RV64-NEXT: bltz a0, .LBB0_3 24; RV64-NEXT: # %bb.1: # %.LBB0_1 25; RV64-NEXT: beqz a1, .LBB0_3 26; RV64-NEXT: # %bb.2: # %.LBB0_2 27; RV64-NEXT: ret 28; RV64-NEXT: .LBB0_3: # %return 29; RV64-NEXT: li a0, 0 30; RV64-NEXT: ret 31entry: 32 %0 = load i16, ptr %a 33 %cmp = icmp sgt i16 %0, -1 34 %tobool.not = icmp eq ptr %b, null 35 br i1 %cmp, label %.LBB0_1, label %return 36 37.LBB0_1: 38 br i1 %tobool.not, label %return, label %.LBB0_2 39 40.LBB0_2: 41 ret i16 %0 42 43return: 44 ret i16 0 45} 46