Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
      2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 < %s | FileCheck %s
      3 
      4 ; bitfieldinsert32: Test for rlwimi
      5 ; equivalent C code
      6 ;   struct s32 {
      7 ;   	int a:8;
      8 ;   	int b:16;
      9 ;   	int c:8;
     10 ;   };
     11 ;   void bitfieldinsert32(struct s32 *p, unsigned int v) {
     12 ;   	p->b = v;
     13 ;   }
     14 
     15 %struct.s32 = type { i32 }
     16 
     17 define void @bitfieldinsert32(%struct.s32* nocapture %p, i32 zeroext %v) {
     18 ; CHECK-LABEL: @bitfieldinsert32
     19 ; CHECK: lwz [[REG1:[0-9]+]], 0(3)
     20 ; CHECK: rlwimi [[REG1]], 4, 8, 8, 23
     21 ; CHECK: stw [[REG1]], 0(3)
     22 ; CHECK: blr
     23 entry:
     24   %0 = getelementptr inbounds %struct.s32, %struct.s32* %p, i64 0, i32 0
     25   %bf.load = load i32, i32* %0, align 4
     26   %bf.value = shl i32 %v, 8
     27   %bf.shl = and i32 %bf.value, 16776960
     28   %bf.clear = and i32 %bf.load, -16776961
     29   %bf.set = or i32 %bf.clear, %bf.shl
     30   store i32 %bf.set, i32* %0, align 4
     31   ret void
     32 }
     33 
     34