brintos

brintos / llvm-project-archived public Read only

0
0
Text · 22.9 KiB · b161d74 Raw
842 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=aarch64--    | FileCheck %s --check-prefixes=CHECK,LE3; RUN: llc < %s -mtriple=aarch64_be-- | FileCheck %s --check-prefixes=CHECK,BE4 5define void @le_i16_to_i8(i16 %x, ptr %p0) {6; LE-LABEL: le_i16_to_i8:7; LE:       // %bb.0:8; LE-NEXT:    strh w0, [x1]9; LE-NEXT:    ret10;11; BE-LABEL: le_i16_to_i8:12; BE:       // %bb.0:13; BE-NEXT:    rev w8, w014; BE-NEXT:    lsr w8, w8, #1615; BE-NEXT:    strh w8, [x1]16; BE-NEXT:    ret17  %sh1 = lshr i16 %x, 818  %t0 = trunc i16 %x to i819  %t1 = trunc i16 %sh1 to i820  %p1 = getelementptr inbounds i8, ptr %p0, i64 121  store i8 %t0, ptr %p0, align 122  store i8 %t1, ptr %p1, align 123  ret void24}25 26define void @le_i16_to_i8_order(i16 %x, ptr %p0) {27; LE-LABEL: le_i16_to_i8_order:28; LE:       // %bb.0:29; LE-NEXT:    strh w0, [x1]30; LE-NEXT:    ret31;32; BE-LABEL: le_i16_to_i8_order:33; BE:       // %bb.0:34; BE-NEXT:    rev w8, w035; BE-NEXT:    lsr w8, w8, #1636; BE-NEXT:    strh w8, [x1]37; BE-NEXT:    ret38  %sh1 = lshr i16 %x, 839  %t0 = trunc i16 %x to i840  %t1 = trunc i16 %sh1 to i841  %p1 = getelementptr inbounds i8, ptr %p0, i64 142  store i8 %t1, ptr %p1, align 143  store i8 %t0, ptr %p0, align 144  ret void45}46 47define void @be_i16_to_i8_offset(i16 %x, ptr %p0) {48; LE-LABEL: be_i16_to_i8_offset:49; LE:       // %bb.0:50; LE-NEXT:    rev w8, w051; LE-NEXT:    lsr w8, w8, #1652; LE-NEXT:    sturh w8, [x1, #11]53; LE-NEXT:    ret54;55; BE-LABEL: be_i16_to_i8_offset:56; BE:       // %bb.0:57; BE-NEXT:    sturh w0, [x1, #11]58; BE-NEXT:    ret59  %sh1 = lshr i16 %x, 860  %t0 = trunc i16 %x to i861  %t1 = trunc i16 %sh1 to i862  %p11 = getelementptr inbounds i8, ptr %p0, i64 1163  %p12 = getelementptr inbounds i8, ptr %p0, i64 1264  store i8 %t0, ptr %p12, align 165  store i8 %t1, ptr %p11, align 166  ret void67}68 69define void @be_i16_to_i8_order(i16 %x, ptr %p0) {70; LE-LABEL: be_i16_to_i8_order:71; LE:       // %bb.0:72; LE-NEXT:    rev w8, w073; LE-NEXT:    lsr w8, w8, #1674; LE-NEXT:    strh w8, [x1]75; LE-NEXT:    ret76;77; BE-LABEL: be_i16_to_i8_order:78; BE:       // %bb.0:79; BE-NEXT:    strh w0, [x1]80; BE-NEXT:    ret81  %sh1 = lshr i16 %x, 882  %t0 = trunc i16 %x to i883  %t1 = trunc i16 %sh1 to i884  %p1 = getelementptr inbounds i8, ptr %p0, i64 185  store i8 %t1, ptr %p0, align 186  store i8 %t0, ptr %p1, align 187  ret void88}89 90define void @le_i32_to_i8(i32 %x, ptr %p0) {91; LE-LABEL: le_i32_to_i8:92; LE:       // %bb.0:93; LE-NEXT:    str w0, [x1]94; LE-NEXT:    ret95;96; BE-LABEL: le_i32_to_i8:97; BE:       // %bb.0:98; BE-NEXT:    rev w8, w099; BE-NEXT:    str w8, [x1]100; BE-NEXT:    ret101  %sh1 = lshr i32 %x, 8102  %sh2 = lshr i32 %x, 16103  %sh3 = lshr i32 %x, 24104  %t0 = trunc i32 %x to i8105  %t1 = trunc i32 %sh1 to i8106  %t2 = trunc i32 %sh2 to i8107  %t3 = trunc i32 %sh3 to i8108  %p1 = getelementptr inbounds i8, ptr %p0, i64 1109  %p2 = getelementptr inbounds i8, ptr %p0, i64 2110  %p3 = getelementptr inbounds i8, ptr %p0, i64 3111  store i8 %t0, ptr %p0, align 1112  store i8 %t1, ptr %p1, align 1113  store i8 %t2, ptr %p2, align 1114  store i8 %t3, ptr %p3, align 1115  ret void116}117 118define void @le_i32_to_i8_order(i32 %x, ptr %p0) {119; LE-LABEL: le_i32_to_i8_order:120; LE:       // %bb.0:121; LE-NEXT:    str w0, [x1]122; LE-NEXT:    ret123;124; BE-LABEL: le_i32_to_i8_order:125; BE:       // %bb.0:126; BE-NEXT:    rev w8, w0127; BE-NEXT:    str w8, [x1]128; BE-NEXT:    ret129  %sh1 = lshr i32 %x, 8130  %sh2 = lshr i32 %x, 16131  %sh3 = lshr i32 %x, 24132  %t0 = trunc i32 %x to i8133  %t1 = trunc i32 %sh1 to i8134  %t2 = trunc i32 %sh2 to i8135  %t3 = trunc i32 %sh3 to i8136  %p1 = getelementptr inbounds i8, ptr %p0, i64 1137  %p2 = getelementptr inbounds i8, ptr %p0, i64 2138  %p3 = getelementptr inbounds i8, ptr %p0, i64 3139  store i8 %t3, ptr %p3, align 1140  store i8 %t1, ptr %p1, align 1141  store i8 %t0, ptr %p0, align 1142  store i8 %t2, ptr %p2, align 1143  ret void144}145 146define void @be_i32_to_i8(i32 %x, ptr %p0) {147; LE-LABEL: be_i32_to_i8:148; LE:       // %bb.0:149; LE-NEXT:    rev w8, w0150; LE-NEXT:    str w8, [x1]151; LE-NEXT:    ret152;153; BE-LABEL: be_i32_to_i8:154; BE:       // %bb.0:155; BE-NEXT:    str w0, [x1]156; BE-NEXT:    ret157  %sh1 = lshr i32 %x, 8158  %sh2 = lshr i32 %x, 16159  %sh3 = lshr i32 %x, 24160  %t0 = trunc i32 %x to i8161  %t1 = trunc i32 %sh1 to i8162  %t2 = trunc i32 %sh2 to i8163  %t3 = trunc i32 %sh3 to i8164  %p1 = getelementptr inbounds i8, ptr %p0, i64 1165  %p2 = getelementptr inbounds i8, ptr %p0, i64 2166  %p3 = getelementptr inbounds i8, ptr %p0, i64 3167  store i8 %t0, ptr %p3, align 1168  store i8 %t1, ptr %p2, align 1169  store i8 %t2, ptr %p1, align 1170  store i8 %t3, ptr %p0, align 1171  ret void172}173 174define void @be_i32_to_i8_order(i32 %x, ptr %p0) {175; LE-LABEL: be_i32_to_i8_order:176; LE:       // %bb.0:177; LE-NEXT:    rev w8, w0178; LE-NEXT:    str w8, [x1]179; LE-NEXT:    ret180;181; BE-LABEL: be_i32_to_i8_order:182; BE:       // %bb.0:183; BE-NEXT:    str w0, [x1]184; BE-NEXT:    ret185  %sh1 = lshr i32 %x, 8186  %sh2 = lshr i32 %x, 16187  %sh3 = lshr i32 %x, 24188  %t0 = trunc i32 %x to i8189  %t1 = trunc i32 %sh1 to i8190  %t2 = trunc i32 %sh2 to i8191  %t3 = trunc i32 %sh3 to i8192  %p1 = getelementptr inbounds i8, ptr %p0, i64 1193  %p2 = getelementptr inbounds i8, ptr %p0, i64 2194  %p3 = getelementptr inbounds i8, ptr %p0, i64 3195  store i8 %t3, ptr %p0, align 1196  store i8 %t2, ptr %p1, align 1197  store i8 %t0, ptr %p3, align 1198  store i8 %t1, ptr %p2, align 1199  ret void200}201 202define void @le_i32_to_i16(i32 %x, ptr %p0) {203; LE-LABEL: le_i32_to_i16:204; LE:       // %bb.0:205; LE-NEXT:    str w0, [x1]206; LE-NEXT:    ret207;208; BE-LABEL: le_i32_to_i16:209; BE:       // %bb.0:210; BE-NEXT:    ror w8, w0, #16211; BE-NEXT:    str w8, [x1]212; BE-NEXT:    ret213  %sh1 = lshr i32 %x, 16214  %t0 = trunc i32 %x to i16215  %t1 = trunc i32 %sh1 to i16216  %p1 = getelementptr inbounds i16, ptr %p0, i64 1217  store i16 %t0, ptr %p0, align 2218  store i16 %t1, ptr %p1, align 2219  ret void220}221 222define void @le_i32_to_i16_order(i32 %x, ptr %p0) {223; LE-LABEL: le_i32_to_i16_order:224; LE:       // %bb.0:225; LE-NEXT:    str w0, [x1]226; LE-NEXT:    ret227;228; BE-LABEL: le_i32_to_i16_order:229; BE:       // %bb.0:230; BE-NEXT:    ror w8, w0, #16231; BE-NEXT:    str w8, [x1]232; BE-NEXT:    ret233  %sh1 = lshr i32 %x, 16234  %t0 = trunc i32 %x to i16235  %t1 = trunc i32 %sh1 to i16236  %p1 = getelementptr inbounds i16, ptr %p0, i64 1237  store i16 %t1, ptr %p1, align 2238  store i16 %t0, ptr %p0, align 2239  ret void240}241 242define void @be_i32_to_i16(i32 %x, ptr %p0) {243; LE-LABEL: be_i32_to_i16:244; LE:       // %bb.0:245; LE-NEXT:    ror w8, w0, #16246; LE-NEXT:    str w8, [x1]247; LE-NEXT:    ret248;249; BE-LABEL: be_i32_to_i16:250; BE:       // %bb.0:251; BE-NEXT:    str w0, [x1]252; BE-NEXT:    ret253  %sh1 = lshr i32 %x, 16254  %t0 = trunc i32 %x to i16255  %t1 = trunc i32 %sh1 to i16256  %p1 = getelementptr inbounds i16, ptr %p0, i64 1257  store i16 %t0, ptr %p1, align 2258  store i16 %t1, ptr %p0, align 2259  ret void260}261 262define void @be_i32_to_i16_order(i32 %x, ptr %p0) {263; LE-LABEL: be_i32_to_i16_order:264; LE:       // %bb.0:265; LE-NEXT:    ror w8, w0, #16266; LE-NEXT:    str w8, [x1]267; LE-NEXT:    ret268;269; BE-LABEL: be_i32_to_i16_order:270; BE:       // %bb.0:271; BE-NEXT:    str w0, [x1]272; BE-NEXT:    ret273  %sh1 = lshr i32 %x, 16274  %t0 = trunc i32 %x to i16275  %t1 = trunc i32 %sh1 to i16276  %p1 = getelementptr inbounds i16, ptr %p0, i64 1277  store i16 %t1, ptr %p0, align 2278  store i16 %t0, ptr %p1, align 2279  ret void280}281 282define void @le_i64_to_i8(i64 %x, ptr %p0) {283; LE-LABEL: le_i64_to_i8:284; LE:       // %bb.0:285; LE-NEXT:    str x0, [x1]286; LE-NEXT:    ret287;288; BE-LABEL: le_i64_to_i8:289; BE:       // %bb.0:290; BE-NEXT:    rev x8, x0291; BE-NEXT:    str x8, [x1]292; BE-NEXT:    ret293  %sh1 = lshr i64 %x, 8294  %sh2 = lshr i64 %x, 16295  %sh3 = lshr i64 %x, 24296  %sh4 = lshr i64 %x, 32297  %sh5 = lshr i64 %x, 40298  %sh6 = lshr i64 %x, 48299  %sh7 = lshr i64 %x, 56300  %t0 = trunc i64 %x to i8301  %t1 = trunc i64 %sh1 to i8302  %t2 = trunc i64 %sh2 to i8303  %t3 = trunc i64 %sh3 to i8304  %t4 = trunc i64 %sh4 to i8305  %t5 = trunc i64 %sh5 to i8306  %t6 = trunc i64 %sh6 to i8307  %t7 = trunc i64 %sh7 to i8308  %p1 = getelementptr inbounds i8, ptr %p0, i64 1309  %p2 = getelementptr inbounds i8, ptr %p0, i64 2310  %p3 = getelementptr inbounds i8, ptr %p0, i64 3311  %p4 = getelementptr inbounds i8, ptr %p0, i64 4312  %p5 = getelementptr inbounds i8, ptr %p0, i64 5313  %p6 = getelementptr inbounds i8, ptr %p0, i64 6314  %p7 = getelementptr inbounds i8, ptr %p0, i64 7315  store i8 %t0, ptr %p0, align 1316  store i8 %t1, ptr %p1, align 1317  store i8 %t2, ptr %p2, align 1318  store i8 %t3, ptr %p3, align 1319  store i8 %t4, ptr %p4, align 1320  store i8 %t5, ptr %p5, align 1321  store i8 %t6, ptr %p6, align 1322  store i8 %t7, ptr %p7, align 1323  ret void324}325 326define void @le_i64_to_i8_order(i64 %x, ptr %p0) {327; LE-LABEL: le_i64_to_i8_order:328; LE:       // %bb.0:329; LE-NEXT:    str x0, [x1]330; LE-NEXT:    ret331;332; BE-LABEL: le_i64_to_i8_order:333; BE:       // %bb.0:334; BE-NEXT:    rev x8, x0335; BE-NEXT:    str x8, [x1]336; BE-NEXT:    ret337  %sh1 = lshr i64 %x, 8338  %sh2 = lshr i64 %x, 16339  %sh3 = lshr i64 %x, 24340  %sh4 = lshr i64 %x, 32341  %sh5 = lshr i64 %x, 40342  %sh6 = lshr i64 %x, 48343  %sh7 = lshr i64 %x, 56344  %t0 = trunc i64 %x to i8345  %t1 = trunc i64 %sh1 to i8346  %t2 = trunc i64 %sh2 to i8347  %t3 = trunc i64 %sh3 to i8348  %t4 = trunc i64 %sh4 to i8349  %t5 = trunc i64 %sh5 to i8350  %t6 = trunc i64 %sh6 to i8351  %t7 = trunc i64 %sh7 to i8352  %p1 = getelementptr inbounds i8, ptr %p0, i64 1353  %p2 = getelementptr inbounds i8, ptr %p0, i64 2354  %p3 = getelementptr inbounds i8, ptr %p0, i64 3355  %p4 = getelementptr inbounds i8, ptr %p0, i64 4356  %p5 = getelementptr inbounds i8, ptr %p0, i64 5357  %p6 = getelementptr inbounds i8, ptr %p0, i64 6358  %p7 = getelementptr inbounds i8, ptr %p0, i64 7359  store i8 %t5, ptr %p5, align 1360  store i8 %t0, ptr %p0, align 1361  store i8 %t3, ptr %p3, align 1362  store i8 %t7, ptr %p7, align 1363  store i8 %t1, ptr %p1, align 1364  store i8 %t6, ptr %p6, align 1365  store i8 %t2, ptr %p2, align 1366  store i8 %t4, ptr %p4, align 1367  ret void368}369 370define void @be_i64_to_i8(i64 %x, ptr %p0) {371; LE-LABEL: be_i64_to_i8:372; LE:       // %bb.0:373; LE-NEXT:    rev x8, x0374; LE-NEXT:    str x8, [x1]375; LE-NEXT:    ret376;377; BE-LABEL: be_i64_to_i8:378; BE:       // %bb.0:379; BE-NEXT:    str x0, [x1]380; BE-NEXT:    ret381  %sh1 = lshr i64 %x, 8382  %sh2 = lshr i64 %x, 16383  %sh3 = lshr i64 %x, 24384  %sh4 = lshr i64 %x, 32385  %sh5 = lshr i64 %x, 40386  %sh6 = lshr i64 %x, 48387  %sh7 = lshr i64 %x, 56388  %t0 = trunc i64 %x to i8389  %t1 = trunc i64 %sh1 to i8390  %t2 = trunc i64 %sh2 to i8391  %t3 = trunc i64 %sh3 to i8392  %t4 = trunc i64 %sh4 to i8393  %t5 = trunc i64 %sh5 to i8394  %t6 = trunc i64 %sh6 to i8395  %t7 = trunc i64 %sh7 to i8396  %p1 = getelementptr inbounds i8, ptr %p0, i64 1397  %p2 = getelementptr inbounds i8, ptr %p0, i64 2398  %p3 = getelementptr inbounds i8, ptr %p0, i64 3399  %p4 = getelementptr inbounds i8, ptr %p0, i64 4400  %p5 = getelementptr inbounds i8, ptr %p0, i64 5401  %p6 = getelementptr inbounds i8, ptr %p0, i64 6402  %p7 = getelementptr inbounds i8, ptr %p0, i64 7403  store i8 %t0, ptr %p7, align 1404  store i8 %t1, ptr %p6, align 1405  store i8 %t2, ptr %p5, align 1406  store i8 %t3, ptr %p4, align 1407  store i8 %t4, ptr %p3, align 1408  store i8 %t5, ptr %p2, align 1409  store i8 %t6, ptr %p1, align 1410  store i8 %t7, ptr %p0, align 1411  ret void412}413 414define void @be_i64_to_i8_order(i64 %x, ptr %p0) {415; LE-LABEL: be_i64_to_i8_order:416; LE:       // %bb.0:417; LE-NEXT:    rev x8, x0418; LE-NEXT:    str x8, [x1]419; LE-NEXT:    ret420;421; BE-LABEL: be_i64_to_i8_order:422; BE:       // %bb.0:423; BE-NEXT:    str x0, [x1]424; BE-NEXT:    ret425  %sh1 = lshr i64 %x, 8426  %sh2 = lshr i64 %x, 16427  %sh3 = lshr i64 %x, 24428  %sh4 = lshr i64 %x, 32429  %sh5 = lshr i64 %x, 40430  %sh6 = lshr i64 %x, 48431  %sh7 = lshr i64 %x, 56432  %t0 = trunc i64 %x to i8433  %t1 = trunc i64 %sh1 to i8434  %t2 = trunc i64 %sh2 to i8435  %t3 = trunc i64 %sh3 to i8436  %t4 = trunc i64 %sh4 to i8437  %t5 = trunc i64 %sh5 to i8438  %t6 = trunc i64 %sh6 to i8439  %t7 = trunc i64 %sh7 to i8440  %p1 = getelementptr inbounds i8, ptr %p0, i64 1441  %p2 = getelementptr inbounds i8, ptr %p0, i64 2442  %p3 = getelementptr inbounds i8, ptr %p0, i64 3443  %p4 = getelementptr inbounds i8, ptr %p0, i64 4444  %p5 = getelementptr inbounds i8, ptr %p0, i64 5445  %p6 = getelementptr inbounds i8, ptr %p0, i64 6446  %p7 = getelementptr inbounds i8, ptr %p0, i64 7447  store i8 %t7, ptr %p0, align 1448  store i8 %t6, ptr %p1, align 1449  store i8 %t5, ptr %p2, align 1450  store i8 %t4, ptr %p3, align 1451  store i8 %t3, ptr %p4, align 1452  store i8 %t2, ptr %p5, align 1453  store i8 %t1, ptr %p6, align 1454  store i8 %t0, ptr %p7, align 1455  ret void456}457 458define void @le_i64_to_i16(i64 %x, ptr %p0) {459; LE-LABEL: le_i64_to_i16:460; LE:       // %bb.0:461; LE-NEXT:    str x0, [x1]462; LE-NEXT:    ret463;464; BE-LABEL: le_i64_to_i16:465; BE:       // %bb.0:466; BE-NEXT:    lsr x8, x0, #16467; BE-NEXT:    lsr x9, x0, #32468; BE-NEXT:    lsr x10, x0, #48469; BE-NEXT:    strh w0, [x1]470; BE-NEXT:    strh w8, [x1, #2]471; BE-NEXT:    strh w9, [x1, #4]472; BE-NEXT:    strh w10, [x1, #6]473; BE-NEXT:    ret474  %sh1 = lshr i64 %x, 16475  %sh2 = lshr i64 %x, 32476  %sh3 = lshr i64 %x, 48477  %t0 = trunc i64 %x to i16478  %t1 = trunc i64 %sh1 to i16479  %t2 = trunc i64 %sh2 to i16480  %t3 = trunc i64 %sh3 to i16481  %p1 = getelementptr inbounds i16, ptr %p0, i64 1482  %p2 = getelementptr inbounds i16, ptr %p0, i64 2483  %p3 = getelementptr inbounds i16, ptr %p0, i64 3484  store i16 %t0, ptr %p0, align 2485  store i16 %t1, ptr %p1, align 2486  store i16 %t2, ptr %p2, align 2487  store i16 %t3, ptr %p3, align 2488  ret void489}490 491define void @le_i64_to_i16_order(i64 %x, ptr %p0) {492; LE-LABEL: le_i64_to_i16_order:493; LE:       // %bb.0:494; LE-NEXT:    str x0, [x1]495; LE-NEXT:    ret496;497; BE-LABEL: le_i64_to_i16_order:498; BE:       // %bb.0:499; BE-NEXT:    lsr x8, x0, #16500; BE-NEXT:    lsr x9, x0, #48501; BE-NEXT:    lsr x10, x0, #32502; BE-NEXT:    strh w0, [x1]503; BE-NEXT:    strh w8, [x1, #2]504; BE-NEXT:    strh w9, [x1, #6]505; BE-NEXT:    strh w10, [x1, #4]506; BE-NEXT:    ret507  %sh1 = lshr i64 %x, 16508  %sh2 = lshr i64 %x, 32509  %sh3 = lshr i64 %x, 48510  %t0 = trunc i64 %x to i16511  %t1 = trunc i64 %sh1 to i16512  %t2 = trunc i64 %sh2 to i16513  %t3 = trunc i64 %sh3 to i16514  %p1 = getelementptr inbounds i16, ptr %p0, i64 1515  %p2 = getelementptr inbounds i16, ptr %p0, i64 2516  %p3 = getelementptr inbounds i16, ptr %p0, i64 3517  store i16 %t1, ptr %p1, align 2518  store i16 %t3, ptr %p3, align 2519  store i16 %t0, ptr %p0, align 2520  store i16 %t2, ptr %p2, align 2521  ret void522}523 524define void @be_i64_to_i16(i64 %x, ptr %p0) {525; LE-LABEL: be_i64_to_i16:526; LE:       // %bb.0:527; LE-NEXT:    ror w8, w0, #16528; LE-NEXT:    lsr x9, x0, #32529; LE-NEXT:    lsr x10, x0, #48530; LE-NEXT:    str w8, [x1, #4]531; LE-NEXT:    strh w9, [x1, #2]532; LE-NEXT:    strh w10, [x1]533; LE-NEXT:    ret534;535; BE-LABEL: be_i64_to_i16:536; BE:       // %bb.0:537; BE-NEXT:    str x0, [x1]538; BE-NEXT:    ret539  %sh1 = lshr i64 %x, 16540  %sh2 = lshr i64 %x, 32541  %sh3 = lshr i64 %x, 48542  %t0 = trunc i64 %x to i16543  %t1 = trunc i64 %sh1 to i16544  %t2 = trunc i64 %sh2 to i16545  %t3 = trunc i64 %sh3 to i16546  %p1 = getelementptr inbounds i16, ptr %p0, i64 1547  %p2 = getelementptr inbounds i16, ptr %p0, i64 2548  %p3 = getelementptr inbounds i16, ptr %p0, i64 3549  store i16 %t0, ptr %p3, align 2550  store i16 %t1, ptr %p2, align 2551  store i16 %t2, ptr %p1, align 2552  store i16 %t3, ptr %p0, align 2553  ret void554}555 556define void @be_i64_to_i16_order(i64 %x, ptr %p0) {557; LE-LABEL: be_i64_to_i16_order:558; LE:       // %bb.0:559; LE-NEXT:    lsr x8, x0, #48560; LE-NEXT:    lsr x9, x0, #32561; LE-NEXT:    lsr x10, x0, #16562; LE-NEXT:    strh w0, [x1, #6]563; LE-NEXT:    strh w8, [x1]564; LE-NEXT:    strh w9, [x1, #2]565; LE-NEXT:    strh w10, [x1, #4]566; LE-NEXT:    ret567;568; BE-LABEL: be_i64_to_i16_order:569; BE:       // %bb.0:570; BE-NEXT:    str x0, [x1]571; BE-NEXT:    ret572  %sh1 = lshr i64 %x, 16573  %sh2 = lshr i64 %x, 32574  %sh3 = lshr i64 %x, 48575  %t0 = trunc i64 %x to i16576  %t1 = trunc i64 %sh1 to i16577  %t2 = trunc i64 %sh2 to i16578  %t3 = trunc i64 %sh3 to i16579  %p1 = getelementptr inbounds i16, ptr %p0, i64 1580  %p2 = getelementptr inbounds i16, ptr %p0, i64 2581  %p3 = getelementptr inbounds i16, ptr %p0, i64 3582  store i16 %t0, ptr %p3, align 2583  store i16 %t3, ptr %p0, align 2584  store i16 %t2, ptr %p1, align 2585  store i16 %t1, ptr %p2, align 2586  ret void587}588 589define void @le_i64_to_i32(i64 %x, ptr %p0) {590; LE-LABEL: le_i64_to_i32:591; LE:       // %bb.0:592; LE-NEXT:    str x0, [x1]593; LE-NEXT:    ret594;595; BE-LABEL: le_i64_to_i32:596; BE:       // %bb.0:597; BE-NEXT:    ror x8, x0, #32598; BE-NEXT:    str x8, [x1]599; BE-NEXT:    ret600  %sh1 = lshr i64 %x, 32601  %t0 = trunc i64 %x to i32602  %t1 = trunc i64 %sh1 to i32603  %p1 = getelementptr inbounds i32, ptr %p0, i64 1604  store i32 %t0, ptr %p0, align 4605  store i32 %t1, ptr %p1, align 4606  ret void607}608 609define void @le_i64_to_i32_order(i64 %x, ptr %p0) {610; LE-LABEL: le_i64_to_i32_order:611; LE:       // %bb.0:612; LE-NEXT:    str x0, [x1]613; LE-NEXT:    ret614;615; BE-LABEL: le_i64_to_i32_order:616; BE:       // %bb.0:617; BE-NEXT:    ror x8, x0, #32618; BE-NEXT:    str x8, [x1]619; BE-NEXT:    ret620  %sh1 = lshr i64 %x, 32621  %t0 = trunc i64 %x to i32622  %t1 = trunc i64 %sh1 to i32623  %p1 = getelementptr inbounds i32, ptr %p0, i64 1624  store i32 %t1, ptr %p1, align 4625  store i32 %t0, ptr %p0, align 4626  ret void627}628 629define void @be_i64_to_i32(i64 %x, ptr %p0) {630; LE-LABEL: be_i64_to_i32:631; LE:       // %bb.0:632; LE-NEXT:    ror x8, x0, #32633; LE-NEXT:    str x8, [x1]634; LE-NEXT:    ret635;636; BE-LABEL: be_i64_to_i32:637; BE:       // %bb.0:638; BE-NEXT:    str x0, [x1]639; BE-NEXT:    ret640  %sh1 = lshr i64 %x, 32641  %t0 = trunc i64 %x to i32642  %t1 = trunc i64 %sh1 to i32643  %p1 = getelementptr inbounds i32, ptr %p0, i64 1644  store i32 %t0, ptr %p1, align 4645  store i32 %t1, ptr %p0, align 4646  ret void647}648 649define void @be_i64_to_i32_order(i64 %x, ptr %p0) {650; LE-LABEL: be_i64_to_i32_order:651; LE:       // %bb.0:652; LE-NEXT:    ror x8, x0, #32653; LE-NEXT:    str x8, [x1]654; LE-NEXT:    ret655;656; BE-LABEL: be_i64_to_i32_order:657; BE:       // %bb.0:658; BE-NEXT:    str x0, [x1]659; BE-NEXT:    ret660  %sh1 = lshr i64 %x, 32661  %t0 = trunc i64 %x to i32662  %t1 = trunc i64 %sh1 to i32663  %p1 = getelementptr inbounds i32, ptr %p0, i64 1664  store i32 %t1, ptr %p0, align 4665  store i32 %t0, ptr %p1, align 4666  ret void667}668 669; Negative test - not consecutive addresses670 671define void @i64_to_i32_wrong_addr(i64 %x, ptr %p0) {672; CHECK-LABEL: i64_to_i32_wrong_addr:673; CHECK:       // %bb.0:674; CHECK-NEXT:    lsr x8, x0, #32675; CHECK-NEXT:    str w0, [x1]676; CHECK-NEXT:    str w8, [x1, #12]677; CHECK-NEXT:    ret678  %sh1 = lshr i64 %x, 32679  %t0 = trunc i64 %x to i32680  %t1 = trunc i64 %sh1 to i32681  %p3 = getelementptr inbounds i32, ptr %p0, i64 3682  store i32 %t1, ptr %p3, align 4683  store i32 %t0, ptr %p0, align 4684  ret void685}686 687; Negative test - addresses don't line up with shift amounts688 689define void @i64_to_i16_wrong_order(i64 %x, ptr %p0) {690; CHECK-LABEL: i64_to_i16_wrong_order:691; CHECK:       // %bb.0:692; CHECK-NEXT:    lsr x8, x0, #48693; CHECK-NEXT:    lsr x9, x0, #16694; CHECK-NEXT:    lsr x10, x0, #32695; CHECK-NEXT:    strh w0, [x1]696; CHECK-NEXT:    strh w8, [x1, #6]697; CHECK-NEXT:    strh w9, [x1, #4]698; CHECK-NEXT:    strh w10, [x1, #2]699; CHECK-NEXT:    ret700  %sh1 = lshr i64 %x, 16701  %sh2 = lshr i64 %x, 32702  %sh3 = lshr i64 %x, 48703  %t0 = trunc i64 %x to i16704  %t1 = trunc i64 %sh1 to i16705  %t2 = trunc i64 %sh2 to i16706  %t3 = trunc i64 %sh3 to i16707  %p1 = getelementptr inbounds i16, ptr %p0, i64 1708  %p2 = getelementptr inbounds i16, ptr %p0, i64 2709  %p3 = getelementptr inbounds i16, ptr %p0, i64 3710  store i16 %t3, ptr %p3, align 2711  store i16 %t1, ptr %p2, align 2712  store i16 %t2, ptr %p1, align 2713  store i16 %t0, ptr %p0, align 2714  ret void715}716 717; Negative test - no store of 't1'718 719define void @i32_to_i8_incomplete(i32 %x, ptr %p0) {720; CHECK-LABEL: i32_to_i8_incomplete:721; CHECK:       // %bb.0:722; CHECK-NEXT:    lsr w8, w0, #16723; CHECK-NEXT:    lsr w9, w0, #24724; CHECK-NEXT:    strb w0, [x1]725; CHECK-NEXT:    strb w8, [x1, #2]726; CHECK-NEXT:    strb w9, [x1, #3]727; CHECK-NEXT:    ret728  %sh1 = lshr i32 %x, 8729  %sh2 = lshr i32 %x, 16730  %sh3 = lshr i32 %x, 24731  %t0 = trunc i32 %x to i8732  %t1 = trunc i32 %sh1 to i8733  %t2 = trunc i32 %sh2 to i8734  %t3 = trunc i32 %sh3 to i8735  %p1 = getelementptr inbounds i8, ptr %p0, i64 1736  %p2 = getelementptr inbounds i8, ptr %p0, i64 2737  %p3 = getelementptr inbounds i8, ptr %p0, i64 3738  store i8 %t0, ptr %p0, align 1739  store i8 %t2, ptr %p2, align 1740  store i8 %t3, ptr %p3, align 1741  ret void742}743 744; Negative test - no store of 't3'745 746define void @i64_to_i8_incomplete(i64 %x, ptr %p0) {747; CHECK-LABEL: i64_to_i8_incomplete:748; CHECK:       // %bb.0:749; CHECK-NEXT:    lsr x8, x0, #56750; CHECK-NEXT:    lsr x9, x0, #48751; CHECK-NEXT:    lsr x10, x0, #40752; CHECK-NEXT:    strb w0, [x1, #7]753; CHECK-NEXT:    strb w8, [x1]754; CHECK-NEXT:    lsr x8, x0, #32755; CHECK-NEXT:    strb w9, [x1, #1]756; CHECK-NEXT:    lsr x9, x0, #16757; CHECK-NEXT:    strb w10, [x1, #2]758; CHECK-NEXT:    lsr x10, x0, #8759; CHECK-NEXT:    strb w8, [x1, #3]760; CHECK-NEXT:    strb w9, [x1, #5]761; CHECK-NEXT:    strb w10, [x1, #6]762; CHECK-NEXT:    ret763  %sh1 = lshr i64 %x, 8764  %sh2 = lshr i64 %x, 16765  %sh3 = lshr i64 %x, 24766  %sh4 = lshr i64 %x, 32767  %sh5 = lshr i64 %x, 40768  %sh6 = lshr i64 %x, 48769  %sh7 = lshr i64 %x, 56770  %t0 = trunc i64 %x to i8771  %t1 = trunc i64 %sh1 to i8772  %t2 = trunc i64 %sh2 to i8773  %t3 = trunc i64 %sh3 to i8774  %t4 = trunc i64 %sh4 to i8775  %t5 = trunc i64 %sh5 to i8776  %t6 = trunc i64 %sh6 to i8777  %t7 = trunc i64 %sh7 to i8778  %p1 = getelementptr inbounds i8, ptr %p0, i64 1779  %p2 = getelementptr inbounds i8, ptr %p0, i64 2780  %p3 = getelementptr inbounds i8, ptr %p0, i64 3781  %p4 = getelementptr inbounds i8, ptr %p0, i64 4782  %p5 = getelementptr inbounds i8, ptr %p0, i64 5783  %p6 = getelementptr inbounds i8, ptr %p0, i64 6784  %p7 = getelementptr inbounds i8, ptr %p0, i64 7785  store i8 %t7, ptr %p0, align 1786  store i8 %t6, ptr %p1, align 1787  store i8 %t5, ptr %p2, align 1788  store i8 %t4, ptr %p3, align 1789  store i8 %t2, ptr %p5, align 1790  store i8 %t1, ptr %p6, align 1791  store i8 %t0, ptr %p7, align 1792  ret void793}794 795; Negative test - not consecutive addresses796 797define void @i32_to_i16_wrong_addr(i32 %x, ptr %p0) {798; CHECK-LABEL: i32_to_i16_wrong_addr:799; CHECK:       // %bb.0:800; CHECK-NEXT:    lsr w8, w0, #16801; CHECK-NEXT:    strh w0, [x1]802; CHECK-NEXT:    strh w8, [x1, #4]803; CHECK-NEXT:    ret804  %sh1 = lshr i32 %x, 16805  %t0 = trunc i32 %x to i16806  %t1 = trunc i32 %sh1 to i16807  %p2 = getelementptr inbounds i16, ptr %p0, i64 2808  store i16 %t1, ptr %p2, align 2809  store i16 %t0, ptr %p0, align 2810  ret void811}812 813; Negative test - addresses don't line up with shift amounts814 815define void @i32_to_i8_wrong_order(i32 %x, ptr %p0) {816; CHECK-LABEL: i32_to_i8_wrong_order:817; CHECK:       // %bb.0:818; CHECK-NEXT:    lsr w8, w0, #24819; CHECK-NEXT:    lsr w9, w0, #16820; CHECK-NEXT:    lsr w10, w0, #8821; CHECK-NEXT:    strb w0, [x1, #3]822; CHECK-NEXT:    strb w8, [x1, #1]823; CHECK-NEXT:    strb w9, [x1]824; CHECK-NEXT:    strb w10, [x1, #2]825; CHECK-NEXT:    ret826  %sh1 = lshr i32 %x, 8827  %sh2 = lshr i32 %x, 16828  %sh3 = lshr i32 %x, 24829  %t0 = trunc i32 %x to i8830  %t1 = trunc i32 %sh1 to i8831  %t2 = trunc i32 %sh2 to i8832  %t3 = trunc i32 %sh3 to i8833  %p1 = getelementptr inbounds i8, ptr %p0, i64 1834  %p2 = getelementptr inbounds i8, ptr %p0, i64 2835  %p3 = getelementptr inbounds i8, ptr %p0, i64 3836  store i8 %t3, ptr %p1, align 1837  store i8 %t2, ptr %p0, align 1838  store i8 %t0, ptr %p3, align 1839  store i8 %t1, ptr %p2, align 1840  ret void841}842