; This test is designed to run twice, once with function attributes and once ; with target attributes added on the command line. ; ; RUN: cat %s > %t.tgtattr ; RUN: echo 'attributes #0 = { nounwind }' >> %t.tgtattr ; RUN: llc -mtriple=riscv32 -mattr=+c -filetype=obj \ ; RUN: -disable-block-placement < %t.tgtattr \ ; RUN: | llvm-objdump -d --triple=riscv32 --mattr=+c -M no-aliases - \ ; RUN: | FileCheck -check-prefix=RV32IC %s ; ; RUN: cat %s > %t.fnattr ; RUN: echo 'attributes #0 = { nounwind "target-features"="+c" }' >> %t.fnattr ; RUN: llc -mtriple=riscv32 -filetype=obj \ ; RUN: -disable-block-placement < %t.fnattr \ ; RUN: | llvm-objdump -d --triple=riscv32 --mattr=+c -M no-aliases - \ ; RUN: | FileCheck -check-prefix=RV32IC %s ; This acts as a sanity check for the codegen instruction compression path, ; verifying that the assembled file contains compressed instructions when ; expected. Handling of the compressed ISA is implemented so the same ; transformation patterns should be used whether compressing an input .s file or ; compressing codegen output. This file contains sanity checks to ensure that is ; working as expected. Particular care should be taken to test pseudo ; instructions. ; Note: TODOs in this file are only appropriate if they highlight a case where ; a generated instruction that can be compressed by an existing pattern isn't. ; It may be useful to have tests that indicate where better compression would be ; possible if alternative codegen choices were made, but they belong in a ; different test file. define i32 @simple_arith(i32 %a, i32 %b) #0 { ; RV32IC-LABEL: : ; RV32IC: addi a2, a0, 1 ; RV32IC-NEXT: c.andi a2, 11 ; RV32IC-NEXT: c.slli a2, 7 ; RV32IC-NEXT: c.srai a1, 9 ; RV32IC-NEXT: c.add a1, a2 ; RV32IC-NEXT: sub a0, a1, a0 ; RV32IC-NEXT: c.jr ra %1 = add i32 %a, 1 %2 = and i32 %1, 11 %3 = shl i32 %2, 7 %4 = ashr i32 %b, 9 %5 = add i32 %3, %4 %6 = sub i32 %5, %a ret i32 %6 } define i32 @select(i32 %a, i32 *%b) #0 { ; RV32IC-LABEL: