1; Tests signed/unsigned extend to 32 bits. 2 3; Show that we know how to translate add. 4 5; NOTE: We use -O2 to get rid of memory stores. 6 7; REQUIRES: allow_dump 8 9; Compile using standalone assembler. 10; RUN: %p2i --filetype=asm -i %s --target=arm32 --args -O2 \ 11; RUN: | FileCheck %s --check-prefix=ASM 12 13; NOTE: We use -O2 to get rid of memory stores. 14 15; Show bytes in assembled standalone code. 16; RUN: %p2i --filetype=asm -i %s --target=arm32 --assemble --disassemble \ 17; RUN: --args -O2 | FileCheck %s --check-prefix=DIS 18 19; Compile using integrated assembler. 20; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \ 21; RUN: | FileCheck %s --check-prefix=IASM 22 23; Show bytes in assembled integrated code. 24; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \ 25; RUN: --args -O2 | FileCheck %s --check-prefix=DIS 26 27define internal i32 @testUxtb(i32 %v) { 28; ASM-LABEL:testUxtb: 29; DIS-LABEL:00000000 <testUxtb>: 30; IASM-LABEL:testUxtb: 31 32entry: 33; ASM-NEXT:.LtestUxtb$entry: 34; IASM-NEXT:.LtestUxtb$entry: 35 36 %v.b = trunc i32 %v to i8 37 %res = zext i8 %v.b to i32 38 39; ASM-NEXT: uxtb r0, r0 40; DIS-NEXT: 0: e6ef0070 41; IASM-NEXT: .byte 0x70 42; IASM-NEXT: .byte 0x0 43; IASM-NEXT: .byte 0xef 44; IASM-NEXT: .byte 0xe6 45 46 ret i32 %res 47} 48 49define internal i32 @testSxtb(i32 %v) { 50; ASM-LABEL:testSxtb: 51; DIS-LABEL:00000010 <testSxtb>: 52; IASM-LABEL:testSxtb: 53 54entry: 55; ASM-NEXT:.LtestSxtb$entry: 56; IASM-NEXT:.LtestSxtb$entry: 57 58 %v.b = trunc i32 %v to i8 59 %res = sext i8 %v.b to i32 60 61; ASM-NEXT: sxtb r0, r0 62; DIS-NEXT: 10: e6af0070 63; IASM-NEXT: .byte 0x70 64; IASM-NEXT: .byte 0x0 65; IASM-NEXT: .byte 0xaf 66; IASM-NEXT: .byte 0xe6 67 68 ret i32 %res 69} 70 71define internal i32 @testUxth(i32 %v) { 72; ASM-LABEL:testUxth: 73; DIS-LABEL:00000020 <testUxth>: 74; IASM-LABEL:testUxth: 75 76entry: 77; ASM-NEXT:.LtestUxth$entry: 78; IASM-NEXT:.LtestUxth$entry: 79 80 %v.h = trunc i32 %v to i16 81 %res = zext i16 %v.h to i32 82 83; ASM-NEXT: uxth r0, r0 84; DIS-NEXT: 20: e6ff0070 85; IASM-NEXT: .byte 0x70 86; IASM-NEXT: .byte 0x0 87; IASM-NEXT: .byte 0xff 88; IASM-NEXT: .byte 0xe6 89 90 ret i32 %res 91} 92 93define internal i32 @testSxth(i32 %v) { 94; ASM-LABEL:testSxth: 95; DIS-LABEL:00000030 <testSxth>: 96; IASM-LABEL:testSxth: 97 98entry: 99; ASM-NEXT:.LtestSxth$entry: 100; IASM-NEXT:.LtestSxth$entry: 101 102 %v.h = trunc i32 %v to i16 103 %res = sext i16 %v.h to i32 104 105; ASM-NEXT: sxth r0, r0 106; DIS-NEXT: 30: e6bf0070 107; IASM-NEXT: .byte 0x70 108; IASM-NEXT: .byte 0x0 109; IASM-NEXT: .byte 0xbf 110; IASM-NEXT: .byte 0xe6 111 112 ret i32 %res 113} 114