brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.5 KiB · 9e3bb8c Raw
331 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc < %s -mtriple=aarch64-linux-gnuabi -O2 | FileCheck %s3 4; The following cases are for i165 6%struct.s_signed_i16 = type { i16, i16, i16 }7%struct.s_unsigned_i16 = type { i16, i16, i16 }8 9@cost_s_i8_i16 = common global %struct.s_signed_i16 zeroinitializer, align 210@cost_u_i16 = common global %struct.s_unsigned_i16 zeroinitializer, align 211 12define void @test_i16_2cmp_signed_1() {13; CHECK-LABEL: test_i16_2cmp_signed_1:14; CHECK:       // %bb.0: // %entry15; CHECK-NEXT:    adrp x8, :got:cost_s_i8_i1616; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_s_i8_i16]17; CHECK-NEXT:    ldrsh w9, [x8, #2]18; CHECK-NEXT:    ldrsh w10, [x8, #4]19; CHECK-NEXT:    cmp w9, w1020; CHECK-NEXT:    b.lt .LBB0_221; CHECK-NEXT:  // %bb.1: // %if.end8.sink.split22; CHECK-NEXT:    strh w9, [x8]23; CHECK-NEXT:  .LBB0_2: // %if.end824; CHECK-NEXT:    ret25entry:26  %0 = load i16, ptr getelementptr inbounds (%struct.s_signed_i16, ptr @cost_s_i8_i16, i64 0, i32 1), align 227  %1 = load i16, ptr getelementptr inbounds (%struct.s_signed_i16, ptr @cost_s_i8_i16, i64 0, i32 2), align 228  %cmp = icmp sgt i16 %0, %129  br i1 %cmp, label %if.then, label %if.else30 31if.then:                                          ; preds = %entry32  store i16 %0, ptr @cost_s_i8_i16, align 233  br label %if.end834 35if.else:                                          ; preds = %entry36  %cmp5 = icmp eq i16 %0, %137  br i1 %cmp5, label %if.then7, label %if.end838 39if.then7:                                         ; preds = %if.else40  store i16 %0, ptr @cost_s_i8_i16, align 241  br label %if.end842 43if.end8:                                          ; preds = %if.else, %if.then7, %if.then44  ret void45}46 47define void @test_i16_2cmp_signed_2() {48; CHECK-LABEL: test_i16_2cmp_signed_2:49; CHECK:       // %bb.0: // %entry50; CHECK-NEXT:    adrp x8, :got:cost_s_i8_i1651; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_s_i8_i16]52; CHECK-NEXT:    ldrsh w9, [x8, #2]53; CHECK-NEXT:    ldrsh w10, [x8, #4]54; CHECK-NEXT:    cmp w9, w1055; CHECK-NEXT:    b.gt .LBB1_256; CHECK-NEXT:  // %bb.1: // %if.else57; CHECK-NEXT:    mov w9, w1058; CHECK-NEXT:    b.ge .LBB1_359; CHECK-NEXT:  .LBB1_2: // %if.end8.sink.split60; CHECK-NEXT:    strh w9, [x8]61; CHECK-NEXT:  .LBB1_3: // %if.end862; CHECK-NEXT:    ret63entry:64  %0 = load i16, ptr getelementptr inbounds (%struct.s_signed_i16, ptr @cost_s_i8_i16, i64 0, i32 1), align 265  %1 = load i16, ptr getelementptr inbounds (%struct.s_signed_i16, ptr @cost_s_i8_i16, i64 0, i32 2), align 266  %cmp = icmp sgt i16 %0, %167  br i1 %cmp, label %if.then, label %if.else68 69if.then:                                          ; preds = %entry70  store i16 %0, ptr @cost_s_i8_i16, align 271  br label %if.end872 73if.else:                                          ; preds = %entry74  %cmp5 = icmp slt i16 %0, %175  br i1 %cmp5, label %if.then7, label %if.end876 77if.then7:                                         ; preds = %if.else78  store i16 %1, ptr @cost_s_i8_i16, align 279  br label %if.end880 81if.end8:                                          ; preds = %if.else, %if.then7, %if.then82  ret void83}84 85define void @test_i16_2cmp_unsigned_1() {86; CHECK-LABEL: test_i16_2cmp_unsigned_1:87; CHECK:       // %bb.0: // %entry88; CHECK-NEXT:    adrp x8, :got:cost_u_i1689; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_u_i16]90; CHECK-NEXT:    ldrh w9, [x8, #2]91; CHECK-NEXT:    ldrh w10, [x8, #4]92; CHECK-NEXT:    cmp w9, w1093; CHECK-NEXT:    b.lo .LBB2_294; CHECK-NEXT:  // %bb.1: // %if.end8.sink.split95; CHECK-NEXT:    strh w9, [x8]96; CHECK-NEXT:  .LBB2_2: // %if.end897; CHECK-NEXT:    ret98entry:99  %0 = load i16, ptr getelementptr inbounds (%struct.s_unsigned_i16, ptr @cost_u_i16, i64 0, i32 1), align 2100  %1 = load i16, ptr getelementptr inbounds (%struct.s_unsigned_i16, ptr @cost_u_i16, i64 0, i32 2), align 2101  %cmp = icmp ugt i16 %0, %1102  br i1 %cmp, label %if.then, label %if.else103 104if.then:                                          ; preds = %entry105  store i16 %0, ptr @cost_u_i16, align 2106  br label %if.end8107 108if.else:                                          ; preds = %entry109  %cmp5 = icmp eq i16 %0, %1110  br i1 %cmp5, label %if.then7, label %if.end8111 112if.then7:                                         ; preds = %if.else113  store i16 %0, ptr @cost_u_i16, align 2114  br label %if.end8115 116if.end8:                                          ; preds = %if.else, %if.then7, %if.then117  ret void118}119 120define void @test_i16_2cmp_unsigned_2() {121; CHECK-LABEL: test_i16_2cmp_unsigned_2:122; CHECK:       // %bb.0: // %entry123; CHECK-NEXT:    adrp x8, :got:cost_u_i16124; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_u_i16]125; CHECK-NEXT:    ldrh w9, [x8, #2]126; CHECK-NEXT:    ldrh w10, [x8, #4]127; CHECK-NEXT:    cmp w9, w10128; CHECK-NEXT:    b.hi .LBB3_2129; CHECK-NEXT:  // %bb.1: // %if.else130; CHECK-NEXT:    mov w9, w10131; CHECK-NEXT:    b.hs .LBB3_3132; CHECK-NEXT:  .LBB3_2: // %if.end8.sink.split133; CHECK-NEXT:    strh w9, [x8]134; CHECK-NEXT:  .LBB3_3: // %if.end8135; CHECK-NEXT:    ret136entry:137  %0 = load i16, ptr getelementptr inbounds (%struct.s_unsigned_i16, ptr @cost_u_i16, i64 0, i32 1), align 2138  %1 = load i16, ptr getelementptr inbounds (%struct.s_unsigned_i16, ptr @cost_u_i16, i64 0, i32 2), align 2139  %cmp = icmp ugt i16 %0, %1140  br i1 %cmp, label %if.then, label %if.else141 142if.then:                                          ; preds = %entry143  store i16 %0, ptr @cost_u_i16, align 2144  br label %if.end8145 146if.else:                                          ; preds = %entry147  %cmp5 = icmp ult i16 %0, %1148  br i1 %cmp5, label %if.then7, label %if.end8149 150if.then7:                                         ; preds = %if.else151  store i16 %1, ptr @cost_u_i16, align 2152  br label %if.end8153 154if.end8:                                          ; preds = %if.else, %if.then7, %if.then155  ret void156}157 158; The following cases are for i8159 160%struct.s_signed_i8 = type { i8, i8, i8 }161%struct.s_unsigned_i8 = type { i8, i8, i8 }162 163@cost_s = common global %struct.s_signed_i8 zeroinitializer, align 2164@cost_u_i8 = common global %struct.s_unsigned_i8 zeroinitializer, align 2165 166 167define void @test_i8_2cmp_signed_1() {168; CHECK-LABEL: test_i8_2cmp_signed_1:169; CHECK:       // %bb.0: // %entry170; CHECK-NEXT:    adrp x8, :got:cost_s171; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_s]172; CHECK-NEXT:    ldrsb w9, [x8, #1]173; CHECK-NEXT:    ldrsb w10, [x8, #2]174; CHECK-NEXT:    cmp w9, w10175; CHECK-NEXT:    b.lt .LBB4_2176; CHECK-NEXT:  // %bb.1: // %if.end8.sink.split177; CHECK-NEXT:    strb w9, [x8]178; CHECK-NEXT:  .LBB4_2: // %if.end8179; CHECK-NEXT:    ret180entry:181  %0 = load i8, ptr getelementptr inbounds (%struct.s_signed_i8, ptr @cost_s, i64 0, i32 1), align 2182  %1 = load i8, ptr getelementptr inbounds (%struct.s_signed_i8, ptr @cost_s, i64 0, i32 2), align 2183  %cmp = icmp sgt i8 %0, %1184  br i1 %cmp, label %if.then, label %if.else185 186if.then:                                          ; preds = %entry187  store i8 %0, ptr @cost_s, align 2188  br label %if.end8189 190if.else:                                          ; preds = %entry191  %cmp5 = icmp eq i8 %0, %1192  br i1 %cmp5, label %if.then7, label %if.end8193 194if.then7:                                         ; preds = %if.else195  store i8 %0, ptr @cost_s, align 2196  br label %if.end8197 198if.end8:                                          ; preds = %if.else, %if.then7, %if.then199  ret void200}201 202define void @test_i8_2cmp_signed_2() {203; CHECK-LABEL: test_i8_2cmp_signed_2:204; CHECK:       // %bb.0: // %entry205; CHECK-NEXT:    adrp x8, :got:cost_s206; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_s]207; CHECK-NEXT:    ldrsb w9, [x8, #1]208; CHECK-NEXT:    ldrsb w10, [x8, #2]209; CHECK-NEXT:    cmp w9, w10210; CHECK-NEXT:    b.gt .LBB5_2211; CHECK-NEXT:  // %bb.1: // %if.else212; CHECK-NEXT:    mov w9, w10213; CHECK-NEXT:    b.ge .LBB5_3214; CHECK-NEXT:  .LBB5_2: // %if.end8.sink.split215; CHECK-NEXT:    strb w9, [x8]216; CHECK-NEXT:  .LBB5_3: // %if.end8217; CHECK-NEXT:    ret218entry:219  %0 = load i8, ptr getelementptr inbounds (%struct.s_signed_i8, ptr @cost_s, i64 0, i32 1), align 2220  %1 = load i8, ptr getelementptr inbounds (%struct.s_signed_i8, ptr @cost_s, i64 0, i32 2), align 2221  %cmp = icmp sgt i8 %0, %1222  br i1 %cmp, label %if.then, label %if.else223 224if.then:                                          ; preds = %entry225  store i8 %0, ptr @cost_s, align 2226  br label %if.end8227 228if.else:                                          ; preds = %entry229  %cmp5 = icmp slt i8 %0, %1230  br i1 %cmp5, label %if.then7, label %if.end8231 232if.then7:                                         ; preds = %if.else233  store i8 %1, ptr @cost_s, align 2234  br label %if.end8235 236if.end8:                                          ; preds = %if.else, %if.then7, %if.then237  ret void238}239 240define void @test_i8_2cmp_unsigned_1() {241; CHECK-LABEL: test_i8_2cmp_unsigned_1:242; CHECK:       // %bb.0: // %entry243; CHECK-NEXT:    adrp x8, :got:cost_u_i8244; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_u_i8]245; CHECK-NEXT:    ldrb w9, [x8, #1]246; CHECK-NEXT:    ldrb w10, [x8, #2]247; CHECK-NEXT:    cmp w9, w10248; CHECK-NEXT:    b.lo .LBB6_2249; CHECK-NEXT:  // %bb.1: // %if.end8.sink.split250; CHECK-NEXT:    strb w9, [x8]251; CHECK-NEXT:  .LBB6_2: // %if.end8252; CHECK-NEXT:    ret253entry:254  %0 = load i8, ptr getelementptr inbounds (%struct.s_unsigned_i8, ptr @cost_u_i8, i64 0, i32 1), align 2255  %1 = load i8, ptr getelementptr inbounds (%struct.s_unsigned_i8, ptr @cost_u_i8, i64 0, i32 2), align 2256  %cmp = icmp ugt i8 %0, %1257  br i1 %cmp, label %if.then, label %if.else258 259if.then:                                          ; preds = %entry260  store i8 %0, ptr @cost_u_i8, align 2261  br label %if.end8262 263if.else:                                          ; preds = %entry264  %cmp5 = icmp eq i8 %0, %1265  br i1 %cmp5, label %if.then7, label %if.end8266 267if.then7:                                         ; preds = %if.else268  store i8 %0, ptr @cost_u_i8, align 2269  br label %if.end8270 271if.end8:                                          ; preds = %if.else, %if.then7, %if.then272  ret void273}274 275define void @test_i8_2cmp_unsigned_2() {276; CHECK-LABEL: test_i8_2cmp_unsigned_2:277; CHECK:       // %bb.0: // %entry278; CHECK-NEXT:    adrp x8, :got:cost_u_i8279; CHECK-NEXT:    ldr x8, [x8, :got_lo12:cost_u_i8]280; CHECK-NEXT:    ldrb w9, [x8, #1]281; CHECK-NEXT:    ldrb w10, [x8, #2]282; CHECK-NEXT:    cmp w9, w10283; CHECK-NEXT:    b.hi .LBB7_2284; CHECK-NEXT:  // %bb.1: // %if.else285; CHECK-NEXT:    mov w9, w10286; CHECK-NEXT:    b.hs .LBB7_3287; CHECK-NEXT:  .LBB7_2: // %if.end8.sink.split288; CHECK-NEXT:    strb w9, [x8]289; CHECK-NEXT:  .LBB7_3: // %if.end8290; CHECK-NEXT:    ret291entry:292  %0 = load i8, ptr getelementptr inbounds (%struct.s_unsigned_i8, ptr @cost_u_i8, i64 0, i32 1), align 2293  %1 = load i8, ptr getelementptr inbounds (%struct.s_unsigned_i8, ptr @cost_u_i8, i64 0, i32 2), align 2294  %cmp = icmp ugt i8 %0, %1295  br i1 %cmp, label %if.then, label %if.else296 297if.then:                                          ; preds = %entry298  store i8 %0, ptr @cost_u_i8, align 2299  br label %if.end8300 301if.else:                                          ; preds = %entry302  %cmp5 = icmp ult i8 %0, %1303  br i1 %cmp5, label %if.then7, label %if.end8304 305if.then7:                                         ; preds = %if.else306  store i8 %1, ptr @cost_u_i8, align 2307  br label %if.end8308 309if.end8:                                          ; preds = %if.else, %if.then7, %if.then310  ret void311}312 313; Make sure the case below won't crash.314 315; The optimization of ZERO_EXTEND and SIGN_EXTEND in type legalization stage can't assert316; the operand of a set_cc is always a TRUNCATE.317 318define i1 @foo(float %inl, float %inr) {319; CHECK-LABEL: foo:320; CHECK:       // %bb.0:321; CHECK-NEXT:    fcvtzs w8, s0322; CHECK-NEXT:    fcvtzs w9, s1323; CHECK-NEXT:    cmp w8, w9324; CHECK-NEXT:    cset w0, eq325; CHECK-NEXT:    ret326  %lval = fptosi float %inl to i8327  %rval = fptosi float %inr to i8328  %sum = icmp eq i8 %lval, %rval329  ret i1 %sum330}331