1; RUN: llc -march=mips -mcpu=mips32 < %s | FileCheck %s --check-prefixes=ALL,BE 2; RUN: llc -march=mipsel -mcpu=mips32 < %s | FileCheck %s --check-prefixes=ALL,LE 3 4; Verify visitTRUNCATE respects endianness when transforming trunc to insert_vector_elt. 5 6; ALL-LABEL: a: 7; BE: lw $2, 4($4) 8; LE: lw $2, 0($4) 9 10define i32 @a(<2 x i32> * %a) { 11entry: 12%0 = load <2 x i32>, <2 x i32> * %a 13%1 = bitcast <2 x i32> %0 to i64 14%2 = trunc i64 %1 to i32 15ret i32 %2 16} 17 18; ALL-LABEL: b: 19; BE: lw $2, 12($4) 20; LE: lw $2, 0($4) 21 22define i32 @b(<4 x i32> * %a) { 23entry: 24%0 = load <4 x i32>, <4 x i32> * %a 25%1 = bitcast <4 x i32> %0 to i128 26%2 = trunc i128 %1 to i32 27ret i32 %2 28} 29 30 31; Verify visitEXTRACT_VECTOR_ELT respects endianness when transforming extract_vector_elt to a trunc. 32 33; ALL-LABEL: c: 34; BE: lw $2, 0($4) 35; LE: lw $2, 0($4) 36 37define i32 @c(i64 * %a) { 38entry: 39%0 = load i64, i64 * %a 40%1 = bitcast i64 %0 to <2 x i32> 41%2 = extractelement <2 x i32> %1, i32 0 42ret i32 %2 43} 44 45; ALL-LABEL: d: 46; BE: lw $2, 4($4) 47; LE: lw $2, 4($4) 48 49define i32 @d(i64 * %a) { 50entry: 51%0 = load i64, i64 * %a 52%1 = bitcast i64 %0 to <2 x i32> 53%2 = extractelement <2 x i32> %1, i32 1 54ret i32 %2 55} 56