Home | History | Annotate | Download | only in SystemZ
      1 ; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s
      2 ;
      3 ; Test that an extension of a load does not get an additional cost in cases
      4 ; where the load performs the extension.
      5 
      6 define void @sext() {
      7   %li8 = load i8, i8* undef
      8   sext i8 %li8 to i16
      9   sext i8 %li8 to i32
     10   sext i8 %li8 to i64
     11 
     12   %li16 = load i16, i16* undef
     13   sext i16 %li16 to i32
     14   sext i16 %li16 to i64
     15 
     16   %li32 = load i32, i32* undef
     17   sext i32 %li32 to i64
     18 
     19   ret void
     20 
     21 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li8 = load i8, i8* undef
     22 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %1 = sext i8 %li8 to i16
     23 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %2 = sext i8 %li8 to i32
     24 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %3 = sext i8 %li8 to i64
     25 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16 = load i16, i16* undef
     26 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %4 = sext i16 %li16 to i32
     27 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %5 = sext i16 %li16 to i64
     28 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32 = load i32, i32* undef
     29 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %6 = sext i32 %li32 to i64
     30 }
     31 
     32 define void @zext() {
     33   %li8 = load i8, i8* undef
     34   zext i8 %li8 to i16
     35   zext i8 %li8 to i32
     36   zext i8 %li8 to i64
     37 
     38   %li16 = load i16, i16* undef
     39   zext i16 %li16 to i32
     40   zext i16 %li16 to i64
     41 
     42   %li32 = load i32, i32* undef
     43   zext i32 %li32 to i64
     44 
     45   ret void
     46 
     47 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li8 = load i8, i8* undef
     48 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %1 = zext i8 %li8 to i16
     49 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %2 = zext i8 %li8 to i32
     50 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %3 = zext i8 %li8 to i64
     51 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li16 = load i16, i16* undef
     52 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %4 = zext i16 %li16 to i32
     53 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %5 = zext i16 %li16 to i64
     54 ; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %li32 = load i32, i32* undef
     55 ; CHECK: Cost Model: Found an estimated cost of 0 for instruction:   %6 = zext i32 %li32 to i64
     56 }
     57