brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · ce4a199 Raw
95 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA323; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA644 5;; Exercise the 'sub' LLVM IR: https://llvm.org/docs/LangRef.html#sub-instruction6 7define i1 @sub_i1(i1 %x, i1 %y) {8; LA32-LABEL: sub_i1:9; LA32:       # %bb.0:10; LA32-NEXT:    xor $a0, $a0, $a111; LA32-NEXT:    ret12;13; LA64-LABEL: sub_i1:14; LA64:       # %bb.0:15; LA64-NEXT:    xor $a0, $a0, $a116; LA64-NEXT:    ret17  %sub = sub i1 %x, %y18  ret i1 %sub19}20 21define i8 @sub_i8(i8 %x, i8 %y) {22; LA32-LABEL: sub_i8:23; LA32:       # %bb.0:24; LA32-NEXT:    sub.w $a0, $a0, $a125; LA32-NEXT:    ret26;27; LA64-LABEL: sub_i8:28; LA64:       # %bb.0:29; LA64-NEXT:    sub.d $a0, $a0, $a130; LA64-NEXT:    ret31  %sub = sub i8 %x, %y32  ret i8 %sub33}34 35define i16 @sub_i16(i16 %x, i16 %y) {36; LA32-LABEL: sub_i16:37; LA32:       # %bb.0:38; LA32-NEXT:    sub.w $a0, $a0, $a139; LA32-NEXT:    ret40;41; LA64-LABEL: sub_i16:42; LA64:       # %bb.0:43; LA64-NEXT:    sub.d $a0, $a0, $a144; LA64-NEXT:    ret45  %sub = sub i16 %x, %y46  ret i16 %sub47}48 49define i32 @sub_i32(i32 %x, i32 %y) {50; LA32-LABEL: sub_i32:51; LA32:       # %bb.0:52; LA32-NEXT:    sub.w $a0, $a0, $a153; LA32-NEXT:    ret54;55; LA64-LABEL: sub_i32:56; LA64:       # %bb.0:57; LA64-NEXT:    sub.w $a0, $a0, $a158; LA64-NEXT:    ret59  %sub = sub i32 %x, %y60  ret i32 %sub61}62 63;; Match the pattern:64;; def : PatGprGpr_32<sub, SUB_W>;65define signext i32 @sub_i32_sext(i32 %x, i32 %y) {66; LA32-LABEL: sub_i32_sext:67; LA32:       # %bb.0:68; LA32-NEXT:    sub.w $a0, $a0, $a169; LA32-NEXT:    ret70;71; LA64-LABEL: sub_i32_sext:72; LA64:       # %bb.0:73; LA64-NEXT:    sub.w $a0, $a0, $a174; LA64-NEXT:    ret75  %sub = sub i32 %x, %y76  ret i32 %sub77}78 79define i64 @sub_i64(i64 %x, i64 %y) {80; LA32-LABEL: sub_i64:81; LA32:       # %bb.0:82; LA32-NEXT:    sltu $a4, $a0, $a283; LA32-NEXT:    sub.w $a1, $a1, $a384; LA32-NEXT:    sub.w $a1, $a1, $a485; LA32-NEXT:    sub.w $a0, $a0, $a286; LA32-NEXT:    ret87;88; LA64-LABEL: sub_i64:89; LA64:       # %bb.0:90; LA64-NEXT:    sub.d $a0, $a0, $a191; LA64-NEXT:    ret92  %sub = sub i64 %x, %y93  ret i64 %sub94}95