brintos

brintos / llvm-project-archived public Read only

0
0
Text · 944 B · b04f0a2 Raw
33 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s | FileCheck %s3 4; Test folding of: (sra (xor (sra x, c1), -1), c2) -> (sra (xor x, -1), c3)5; Original motivating example: should merge sra+sra across xor6define i16 @not_invert_signbit_splat_mask(i8 %x, i16 %y) {7; CHECK-LABEL: not_invert_signbit_splat_mask:8; CHECK:       # %bb.0:9; CHECK-NEXT:    slli a0, a0, 5610; CHECK-NEXT:    srai a0, a0, 6211; CHECK-NEXT:    not a0, a012; CHECK-NEXT:    and a0, a0, a113; CHECK-NEXT:    ret14  %a = ashr i8 %x, 615  %n = xor i8 %a, -116  %s = sext i8 %n to i1617  %r = and i16 %s, %y18  ret i16 %r19}20 21; Edge case22define i16 @sra_xor_sra_overflow(i8 %x, i16 %y) {23; CHECK-LABEL: sra_xor_sra_overflow:24; CHECK:       # %bb.0:25; CHECK-NEXT:    li a0, 026; CHECK-NEXT:    ret27  %a = ashr i8 %x, 1028  %n = xor i8 %a, -129  %s = sext i8 %n to i1630  %r = and i16 %s, %y31  ret i16 %r32}33